美文网首页一步步学习iosiOS适配
Xcode12 编译报错: built for iOS, for

Xcode12 编译报错: built for iOS, for

作者: OnePi | 来源:发表于2020-09-23 16:33 被阅读0次

    升级Xcode12后,编译项目时,可能会出现以下错误:

    building for iOS Simulator, but linking in object:

    building for iOS Simulator, but linking in object ... file built for iOS, for architecture arm64
    

    Embedded binary is not signed with the same certificate:

    Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
    Embedded Binary Signing Certificate: XXX 
    Parent App Signing Certificate: XXX 
    

    .app" couldn’t be opened because you don’t have permission to view it.:

    The file "XXX.app" couldn’t be opened because you don’t have permission to view it.
    

    产生这些报错的根本原因是新版本的Xcode 12更改了编译架构的设置方式

    旧版本的Xcode编译架构设置方式: 用Xcode打开项目 -> Project -> PROJECT -> Build Setting ->

    1. 首先在Architectures -> Valid Architectures -> 设置可用的编译架构指令集
    2. 然后在User-Defined -> EXCLUDED_ARCHS -> 设置排除的编译架构指令集

    新版Xcode12的编译架构设置方式: 用Xcode打开项目 -> Project -> PROJECT -> Build Setting ->

    1. 首先在Architectures -> Excluded Architectures -> 排除的编译架构指令集
    2. 然后在User-Defined -> VALID_ARCHS -> 设置可用的编译架构指令集

    因此,解决上述问题的方案就是在新版的Xcode12中设置:

    1. 在Architectures -> Excluded Architectures -> 设置排除的编译架构指令集为"arm64"。(建议只设置Debug模式,Release模式还是要支持arm64的,否则打包后无法在真机上海安装)
    2. 同时,删除User-Defined中的VALID_ARCHS栏,即可用的编译架构指令集的设置(操作方法:选择PROJECT -> Build Setting ->User-Defined ->选中VALID_ARCHS,直接按Delete键)。

    相关文章

      网友评论

        本文标题:Xcode12 编译报错: built for iOS, for

        本文链接:https://www.haomeiwen.com/subject/pnsoyktx.html