升級Xcode12后,編譯項(xiàng)目時(shí),可能會(huì)出現(xiàn)以下錯(cuò)誤:
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.
產(chǎn)生這些報(bào)錯(cuò)的根本原因是新版本的Xcode 12更改了編譯架構(gòu)的設(shè)置方式:
舊版本的Xcode編譯架構(gòu)設(shè)置方式: 用Xcode打開項(xiàng)目 -> Project -> PROJECT -> Build Setting ->
- 首先在Architectures -> Valid Architectures -> 設(shè)置可用的編譯架構(gòu)指令集
- 然后在User-Defined -> EXCLUDED_ARCHS -> 設(shè)置排除的編譯架構(gòu)指令集
而新版Xcode12的編譯架構(gòu)設(shè)置方式: 用Xcode打開項(xiàng)目 -> Project -> PROJECT -> Build Setting ->
- 首先在Architectures -> Excluded Architectures -> 排除的編譯架構(gòu)指令集
- 然后在User-Defined -> VALID_ARCHS -> 設(shè)置可用的編譯架構(gòu)指令集
因此,解決上述問題的方案就是在新版的Xcode12中設(shè)置:
- 在Architectures -> Excluded Architectures -> 設(shè)置排除的編譯架構(gòu)指令集為"arm64"。(建議只設(shè)置Debug模式,Release模式還是要支持arm64的,否則打包后無法在真機(jī)上海安裝)
- 同時(shí),刪除
User-Defined中的VALID_ARCHS欄,即可用的編譯架構(gòu)指令集的設(shè)置(操作方法:選擇PROJECT -> Build Setting ->User-Defined ->選中VALID_ARCHS,直接按Delete鍵)。