iOS 验证存档因 CFBundleIdentifier 冲突和无效包而失败
iOS Validate archive failed with CFBundleIdentifier Collision & Invalid Bundle
我存档了我的应用程序并想上传 ipa 文件。
但是,上传失败并出现这些错误。
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.Alamofire' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.AlamofireImage' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.swiftyjson.SwiftyJSON' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/Frameworks/MyAppEmbedded.framework' contains disallowed nested bundles.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/Frameworks/MyAppEmbedded.framework' contains disallowed file 'Frameworks'.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/PlugIns/MyAppShare.appex' contains disallowed nested bundles.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/PlugIns/MyAppShare.appex' contains disallowed file 'Frameworks'.
项目使用 Swift,但某些第三方库使用 Objective-C。
这些是我的项目结构。
目标
我的应用程序 - 主应用程序
MyAppEmbedded - 嵌入式框架
MyAppShare - 共享扩展
MyApp、MyAppEmbedded 和 MyAppShare 使用 Carthage 和 CocoaPods。
这是 MyApp "Embedded Binaries" 和 "Linked Frameworks and Libraries"
这是 MyAppEmbedded "Linked Frameworks and Libraries"
这是 MyAppShare "Linked Frameworks and Libraries"
CFBundleIdentifier 发生冲突错误 "Alamofire"、"AlamofireImage" 和 "SwiftyJSON"。
MyAppEmbedded使用了这三个框架。
所以,我认为嵌入式框架是有原因的。
另外,我注意到 ipa 内容很奇怪。
嵌入式框架包括三个相同的嵌入式框架。
我阅读了一些关于上传错误的问题并检查了构建设置。
MyApp:"Always Embed Swift Standard Libraries" 是
MyAppEmedded 和 MyAppShare:"Always Embed Swift Standard Libraries" 否
如果您知道这个错误,请告诉我。
我找到了解决办法。
我从嵌入式框架和 ShareExtension 中删除了主应用程序使用的框架。
并且可以构建我的应用程序并且可以上传验证。
我以为Embedded Framework和Extension需要包含框架,但只有主应用包含框架,其他目标也可以使用主应用包含的框架。
我的模块设置如下:
First module
Second module (embeds First module)
Main App (embeds First and Second module)
将第二个模块目标(不是主应用程序!)中的第一个模块的 Embed
设置为 Do Not Embed
解决了我的问题 ✅
我存档了我的应用程序并想上传 ipa 文件。
但是,上传失败并出现这些错误。
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.Alamofire' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.AlamofireImage' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.swiftyjson.SwiftyJSON' under the iOS application 'MyApp.app'.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/Frameworks/MyAppEmbedded.framework' contains disallowed nested bundles.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/Frameworks/MyAppEmbedded.framework' contains disallowed file 'Frameworks'.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/PlugIns/MyAppShare.appex' contains disallowed nested bundles.
App Store Connect Operation Error
Invalid Bundle. The bundle at 'MyApp.app/PlugIns/MyAppShare.appex' contains disallowed file 'Frameworks'.
项目使用 Swift,但某些第三方库使用 Objective-C。
这些是我的项目结构。
目标
我的应用程序 - 主应用程序
MyAppEmbedded - 嵌入式框架
MyAppShare - 共享扩展
MyApp、MyAppEmbedded 和 MyAppShare 使用 Carthage 和 CocoaPods。
这是 MyApp "Embedded Binaries" 和 "Linked Frameworks and Libraries"
MyAppEmbedded使用了这三个框架。
所以,我认为嵌入式框架是有原因的。
另外,我注意到 ipa 内容很奇怪。
嵌入式框架包括三个相同的嵌入式框架。
我阅读了一些关于上传错误的问题并检查了构建设置。
MyApp:"Always Embed Swift Standard Libraries" 是
MyAppEmedded 和 MyAppShare:"Always Embed Swift Standard Libraries" 否
如果您知道这个错误,请告诉我。
我找到了解决办法。
我从嵌入式框架和 ShareExtension 中删除了主应用程序使用的框架。
并且可以构建我的应用程序并且可以上传验证。
我以为Embedded Framework和Extension需要包含框架,但只有主应用包含框架,其他目标也可以使用主应用包含的框架。
我的模块设置如下:
First module
Second module (embeds First module)
Main App (embeds First and Second module)
将第二个模块目标(不是主应用程序!)中的第一个模块的 Embed
设置为 Do Not Embed
解决了我的问题 ✅