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

iOS中常见错误

2015-10-23 09:54 543 查看
1.当我们在定义一个新的属性时,用到了new、copy这些字时会报错:Property follows Cocoa naming convention for returning'owned' objects

原因是苹果在新的编码时,不推荐以new、copy开头的命名

解决办法是换个命名,哈哈~

2.Info.plist与Prefix.pch修改文件位置遇到的问题及解决方法

如果要更改Info.plist与Prefix.pch文件实际路径,也就是实际文件的位置(不是在工程中的组织路径),需要到Build Settings中修改对应的配置,不然工程就找不到对应的Info.plist与Prefix.pch文件。

报错情况:

1、Info.plist文件路径错误
error: could not read data from '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Info.plist': The file “Gasake-Info.plist” couldn’t be opened because there is no
such file.

2、prefix.pch文件路径错误

clang: error: no such file or directory: '/Users/sf_gxd/Desktop/Gasake/Gasake/Gasake-Prefix.pch'

clang: error: no input files

解决方案:

将路径按照自己工程修改正确,Clean一下,然后运行即可。

修改如下所示






3.The file “Info.plist” couldn’t be opened because there is
no such file

修改了Info.plist的实际文件位置(项目和单元测试对应不同的Info.plist),报错

(null): could not read data from '/Users/xxxxx/Desktop/gsk/zhsy/zhsy/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

解决办法

情景1.如果有单元测试,那就设置一下单元测试target的info,与项目target不是一个路径。



情景2.如果已经删除单元测试相关文件,则是删的不够彻底,把单元测试的target也删掉就OK了。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: