【iOS開發】一些常見的警告解決方案(更新中。。。)
Unknown pattern color for the Background Color attribute
1.背景色屬性為未知模式的顏色
解決:預設xib裡面控制元件的背景色為Default。如果出現警告,可能是你定義的顏色Xcode啟動時識別不了,請重新檢查每個控制元件的背景色,在設定一下顏色就可以了。
Unused variable ‘temString’
2.變數沒有被使用
解決:變數定義了,可是沒有使用,可以考慮把這個變數刪除掉。
<1>Format specifies type ‘unsigned long’ but the argument has type ‘unsigned int’
<2>Values of type ‘NSInteger’ should not be used as format arguments; add an explicit cast to ‘long’ instead
3.這個警告一般會出現在NSStringWithFormat裡面 前面%d %lu 什麼的和後面填進去的引數不匹配就報了警告
解決:NSLog(@”data: %ld bytes”, (unsigned long)[(NSData*)obj length]);
‘sizeWithFont:constrainedToSize:lineBreakMode:’ is deprecated: first deprecated in iOS 7.0 - Use -boundingRectWithSize:options:attributes:context:
4.方法太舊,被廢除了。
解決:舊的方法sizeWithFontToSize在iOS7後就廢除了取而代之是boundingRectWithSize方法
Method definition for ‘shareIHEFESDK’ not found
5. .h 申明的方法沒有實現函式
解決:在 .m 檔案中實現 - (void)shareIHEFESDK{ }方法。
6.Xcode Archive出來的包在本地Organizer中看到的App沒有圖示的問題
解決:檢查App中得xxx-info.plist檔案中,新增Icon file屬性,並填上非retian和Retian螢幕對應的icon檔名稱(檔案必須存在,且命名如下),如下圖所示:
再次Archive即可發現,本地的Organizerz中的App有icon了。