iOS开发-- 开发中遇到的问题汇总

1. CUICatalog: Invalid asset name supplied:

今天写了加载图片,默认图片写的是[UIImage imageNamed:@""],之后就报下面的错误,

这个提示的意思是说你用了这个方法
 
[UIImage imageNamed:name];但是这个name却是空的,所以就报了这个错了。
解决方法,在项目中搜索UIImage imageNamed:,然后打印看看所谓的name是否为空。找到后替换。
 
2. the identity used to sign the executable is no longer valid.
更新Code Signing-Provisioning Profile 
 
3.XCode 7上传遇到ERROR ITMS-90535 Unexpected CFBundleExecutable Key. 的解决办法

找到腾讯的info。plist 

删除箭头指向的一行

重新打包,上传。

4.CGContextSaveGState: invalid context 0x0 Error only on device

UIViewControllerBasedStatusBarAppearance in my Info.plist 

SetUIViewControllerBasedStatusBarAppearance to YES

5.xcode在真机调试的时候出现"The identity used to sign the executable is no longer valid"

Xcode中的Build Settings中设置好Provisioning Profile

 

6.sizeWithFont:constrainedToSize在iOS7以后deprecated

NSDictionary *attributes = @{NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:14]};
// NSString class method: boundingRectWithSize:options:attributes:context is
// available only on ios7.0 sdk.
CGRect rect = [textToMeasure boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:attributes
                                          context:nil];

http://stackoverflow.com/questions/19145078/ios-7-sizewithattributes-replacement-for-sizewithfontconstrainedtosize

 

7.统计Xcode代码行数 

如果要统计ios开发代码,包括头文件的,终端命令进入项目目录下,命令如下

  1. find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs wc -l  

列出每个文件的行数

  1. find . -name "*.m" -or -name "*.h" -or -name "*.xib" -or -name "*.c" |xargs grep -v "^$"|wc -l  

列出代码行数总和

  • grep -v "^$"是去掉空行
  • 注释也统计在代码量之内,毕竟也一个字一个字码出来的

 http://www.cnblogs.com/visen-0/archive/2013/02/18/2915147.html

 

原文地址:https://www.cnblogs.com/feiling/p/4854961.html