Xcode编译过程中 的部分警告处理(后续更新)


Xcode编译过程中 的部分警告处理(后续更新)

一个有节操的程序员会在乎自己的代码的警告,就像在乎饭碗边上有只死蟑螂那样。——@onevca

推荐导读文章 —— 王巍大神的  《谈谈Objective-C的Xcode编译警告》

Xcode编译过程中 ,有些警告,虽然有时不影响程序的运行,看起来很揪心。我们应该有足够的重视,因为这是程序存在的运行风险,甚至有些情况下,会出现意想不到的bug。下面是一些警告的处理。

一、方法过期,或 使用新的api  替换方案

multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:

使用替代方案:

multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:

二、storyboard 不支持的配置 警告

storyboard: warning: Unsupported Configuration: Plain Style unsupported in a Navigation Item

原因是你导航栏上的按钮使用了不支持的 style

see   修改 Plain 为Done   fix waring 

1、storyboard: warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.

大意是为了在程序中动态访问Scene,需要给其设置一个Storyboard ID,所以给出了警告,解决方法:设置一个Storyboard ID即可. (基本上sb钟的所有VC都需要加,才可消除警告,这里根据自己需求。但也可检查出 sb里面无用的VC,可以干掉)。

2、storyboard: warning: Unsupported Configuration: Prototype table cells must have reuse identifiers

必须给sb 里德cell 添加重用标示。(这里看需求。)

3、storyboard: warning: Unsupported Configuration: Segues initiated directly from view controllers must have an identifier for use with -[UIViewController performSegueWithIdentifier:sender:]

大意:segues 没有设置标识,虽然有连线。这种一般都可以废弃。或 重新添加标示 结合代码。

4、 storyboard Frame for "Table View" will be different at run time.

不全的 约束导致。谨慎修改。可能是代码中需要。

5、 storyboard: warning: Ambiguous Layout: Size and vertical position are ambiguous for "Add Address View".

同上 ,默林两颗的 约束,解放方案同上。

6、storyboard: warning: Ambiguous Layout: Horizontal position is ambiguous for "Scroll View".

自动约束 位置不明确,补全。

三、Images.xcassets 相关

1、 Images.xcassets/: warning: Missing Content: The file "credit_card_light.png" for the image set "credit_card_light" does not exist.


原因: png图像文件拷贝失败,看看信息上面提示Can't find哪个文件,一般都是从文件系统里删除文件而没有通过Xcode删除造成的,Xcode的项目配置文件依然纪录着这个文件的引用  
解决办法: 给文件系统里增加相应的文件,或者从Xcode的Groups & Files删除它,或者从Target的Copy Bundle Resources里删除它。 

credit_card_light.png 不存在。  but, 明明存在。  show finder 。Xcode打开json文件,Contents.json .对比其他正常的。删掉上面的"filename" : "credit_card_light.png       再次编译  OK。

2、Images.xcassets/: warning: Ambiguous Content: The app icon set "AppIcon" has an unassigned child.

解决办法:

(1)、查找到该AppIcon对应的JSON 文件   Images.xcassets ——> AppIcon.appiconset ————> Contents.json


(2)、  右击 用Xcode 打开。 对比查找那些是你没有赋值添加图片的子 字典,将它 删除。

(3)、保存文件,关闭JSON 文件,再次 运行 Xcode  ,OK  ,问题解决。

四、SVN相关 警告

1、svn删除文件后报错 ”xx“is missing from working copy

删除的文件很多处理起来很麻烦的,「.svn」
最快的方式是在终端输入

sudo find /Users/justfly/Documents/workspace/justSVN/ -name ".svn" -exec rm -r {} \;

意思就是在/Users/justfly/Documents/workspace/justSVN/ 中所有的「.svn」并用rm刪除
-r的参数是为了不要一个个去按「y」



你可能感兴趣的:(iOS开发总结,打包上传,ERROR)