iOS之调试时出现的部分问题

示例一
The certificate used to sign "XXXXXX" has either expired or has been revoked. An updated certificate is required to sign and install the application.

打开“钥匙串访问”->我的证书:删除相关的证书

真机运行,Fix即可。

示例二

dyld: Library not loaded: @rpath/libswiftCore.dylib
** Referenced from: /var/containers/Bundle/Application/43ADEA88-8A5A-4ACF-A95E-E4C81E80363D/BaskSharing.app/BaskSharing**
** Reason: no suitable image found. Did find:**
** /private/var/containers/Bundle/Application/43ADEA88-8A5A-4ACF-A95E-E4C81E80363D/BaskSharing.app/Frameworks/libswiftCore.dylib: mmap() errno=1 validating first page of '/private/var/containers/Bundle/Application/43ADEA88-8A5A-4ACF-A95E-E4C81E80363D/BaskSharing.app/Frameworks/libswiftCore.dylib'**

解决办法:
1.在targets->build settings,搜索runpath search paths ,增加一个@executable_path/Frameworks

2.如果原来就有这个条目,删除重新添加下,记得clean下项目

3.target - > build settings - > embedded content contains swift code ,此条目apple 默认是不开启的,如果上面方法还是不能解决的话,就把这个条目设置成YES,
改好之后,clean 一下再重新 build。

示例三:
error: linker command failed with exit code 1 (use -v to see invocation) /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc

解决方案:
这种错误有很多种情况:
1.依赖库满意添加
2.某些文件路径配置错误
3.architecture设置
在targets->build settings,搜索 build active architecture only
本项目中把这个属性build active architecture only设置为YES了。

示例四:
'Pods/UmengSocialCOM/Umeng_SDK_Social_iOS_ARM64_5.2.1/UMSocial_Sdk_Extra_Frameworks/AlipayShare/libAPOpenSdk.a(APOpenAPIObject.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

由于Xcode自身的一些小问题,运行项目时一直报错错误的内容.原来是友盟的二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode.
至于什么是bitcode,请看这里:
苹果官方文档

Bitcode (iOS, watchOS)Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.Xcode hides symbols generated during build time by default, so they are not readable by Apple. Only if you choose to include symbols when uploading your app to iTunes Connect would the symbols be sent to Apple. You must include symbols to receive crash reports from Apple.Note: For iOS apps, bitcode is the default, but optional. If you provide bitcode, all apps and frameworks in the app bundle need to include bitcode. For watchOS apps, bitcode is required.
Bitcode 是编译的应用程序的中间一种形式.你提交到AppStore上的应用程序包含的bitcode会在AppStore上被编译和链接.在未来包含bitcode的应用程序,会让Apple重新优化你的二进制文件而不需要重新提交新的版本.意思就是加入苹果会更换硬件架构(CPU之类的).开发者也不需要再根据不同的平台开发新的软件.Xcode在编译时默认是隐藏symbols的.所以Apple拿不到symbols.只有在你提交APP 到 iTunes Connect时选择了提交symbols.Apple才会拿到程序的symbols.如果你想要收到Apple的crash 报告的话.必须要把symbols提交上去.注意: iOS APP,bitcode是默认的.但是不是必须的.但是你如果支持bitcode的话,那么应用中的的app和frameworks都必须包含bitcode.对watchOS app来说,bitcode是必须的.

解决方案
在targets->Build Settings,搜索 bitcode
我们可以在”Enable Bitcode”选项中看到这个设置。将其设为NO即可

不过,我们现在需要考虑的是三个平台:iOS,Mac OS,watchOS。

对应iOS,bitcode是可选的。

对于watchOS,bitcode是必须的。

Mac OS不支持bitcode。

示例五:
CodeSign error: no provisioning profile at path '/Users/qingyun/Library/MobileDevice/Provisioning Profiles/8756bca9-3fb9-404c-8c83-1f5193faf306.mobileprovision'

解决参考:Certificates & Identifiers & Provisioning Profiles

你可能感兴趣的:(iOS之调试时出现的部分问题)