您的位置:首页 > 移动开发 > IOS开发

ios开发中遇到的奇葩问题

2015-09-08 09:36 363 查看
1.假设imgList为一个0个object的数组对象

   0<( imgList.count-1 )为真...

  
2.fatal error: 'XCTest/XCTest.h' file not found

解决方法:
在报错的Target中的Building settings中FRAMEWORK_SEARCH_PATHS添加$(PLATFORM_DIR)/Developer/Library/Frameworks

3.又是一个来自XCTest的坑爹问题:
dyld: Library not loaded: @rpath/XCTest.framework/XCTest
  Referenced from: /private/var/mobile/Containers/Bundle/Application/3A8F980D-F647-4D6D-B95A-88EC600BCA6B/RR.app/RR
  Reason: image not found
  
解决办法:工程-》targets-》Bulid Phases-》complie Sources-》搜索一下是否有test,有的话,删除一下即可。
 

4.viewController退出时不运行dealloc

解决方法:可能是...setTarget:self...的对象没有对self release。(setTarget时把self retain了)

比如说:在nstimer重复执行时,想要在退出时invalidate,要在viewWillDisappear中执行,而不能在dealloc中执行,因为self的retain count此时为1。在viewWillDisappear中invalidate之后,dealloc也可以顺利执行了。

5.CocoaPod运行问题

运行pod install时,提示An error occurred while processing the post-install hook of the Podfile.undefined method `project` for #<Pod::Installer:0x007ffa309af2e0>
处理方法:
打开Podfile,把里面的 project 改为 pods_project

6.自定义UITabBar的item的title无法改变颜色

使用:[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blueColor], NSForegroundColorAttributeName,
nil] forState:UIControlStateNormal];无法改变item的title颜色

必须使用:[[UITabBarItem appearance]setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blueColor], NSForegroundColorAttributeName,
nil] forState:UIControlStateNormal];

关键是:UITabBarItem appearance

7.状态栏以及整个界面所有元素变大的问题

出现这个问题的原因是没设置系统启动图。必须为app添加系统默认启动图才可恢复正常size。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: