欢迎加入QQ讨论群258996829
麦子学院 头像
苹果6袋
6
麦子学院

怎么解决Xcode报错

发布时间:2016-06-20 15:17  回复:0  查看:2986   最后回复:2016-06-20 15:17  

在开发中,我们时常遇到Xcode开发工具报错的情况,遇到这种情况该怎么解决呢?这里汇总了几个解决办法。

1. An App ID with Identifier 'com.XXX.XXX’ is not available. Please enter a different string.
宗旨:移除钥匙串中的开发证书,重新导入
1) 完全关闭Xcode;
2) 找到钥匙串,将钥匙串(Keychain)中的对应证书移除;
3) 再次打开Xcode,通过Preferences - View Details - download新的证书;
4) 选择正确的appID,运行项目。

 

2. <code livecodeserver="">The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.</code>
解决方法1
1) Info.plist中添加NSAppTransportSecurity类型Dictionary
2) NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
3) 注意,单元测试下面也有一个Info.plist,修改那个文件是没有作用的!
解决方法2
让有的域名支持https的话也可以这么配置:

怎么解决Xcode报错

3. “Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found” 
解决:命令行分别输入下面语句,删除所有的Profiles
cd ~/Library/MobileDevice/Provisioning\\\\ Profiles/
rm *.mobileprovision

4. Please verify that your device’s clock is properly set, and that your signing certificate is not expired
1) 关闭项目,找到项目文件XXXX.xcodeproj,在文件上点击右键,选择显示包内容Show Package Contents)。会新打开一个Finder
2) 在新打开的Finder中找到project.pbxproj,并且打开,找到所有包含报错的UUID‘XXX’的行(包含UUID后面的一串数字的行,可能不包含"UUID"),整行删除。
3) 保存,重新启动项目,再编译,就OK了。

 

5. @2x@3x图片无法提交SVN
原因:add a "@" character at the end of all "@2x" files while checking in and your problem with subversion will be solved.
in other words, "svn add blahblah@2x.png@" (where blahblah is the true name of the Retina high rez image files) at the terminal and then explicitly commit that. In other words, don't add these files from Xcode, use the command line in the Terminal.
Subversion can have troubles with files with "@" in the filename.
命令行解决步骤:
svn add image_file_name\\\\@3x.png@
svn commit -m “add your comment here"

 

6. CodeSign error: no provisioning profile at path '/Users/zhht-2015/Library/MobileDevice/Provisioning Profiles/79693141-f98b-4ac4-8bb4-476c9475f265.mobileprovision'
1) 关闭Xcode,找到项目中的**.xcodeproj文件,点击右键,show package contents(打开包内容)
2) 打开后找到project.pbxproj文件,用文本编辑器打开。其实就是右键,点击open就好了。
3) 打开这个文件后,按command+F,在这个文件中查找“PROVISIONING_PROFILE",找到这个
PROVISIONING_PROFILE = "79693141-f98b-4ac4-8bb4-476c9475f265";
并删除。
4) 然后保存文件,重新打开项目。xcode会提示你重新下载安装provisioning profile文件。下载后安装上就可以。

下面的是我重启Xcode后自动默认的,之前的设置都被重置了,也正是这个问题导致我做APNS推送时注册deviceToken成功和失败的函数都不回调,要么就是注册成功了发送消息成功了但是接收不到。我按照默认设置重新运行后推送测试可以了。

怎么解决Xcode报错

 

7. [NSBundle mainBundle] pathForResource: ofType: nil
资源没有真正添加到bundle中,需要在项目设置中,build phases —> copy bundle resources 点击 重新添加即可。

 

 
原文来自:简书/Restar

您还未登录,请先登录

热门帖子

最新帖子