Xcode归档验证失败:CFBundleIdentifier冲突与格式错误求助
Flutter项目Transporter上传归档文件的Bundle ID问题解决办法
问题描述
- Asset validation failed CFBundleIdentifier Collision:iOS应用Runner.app下存在多个CFBundleIdentifier值为
com.atlas.almaz的包(ID:52b4c9ca-b0cf-432b-b112-51a2d228270e) - Asset validation failed Bad bundle identifier:应用扩展Runner.app/PlugIns/OneSignalNotificationServiceExtension.appex的bundle identifier
com.atlas.almaz不符合规则,需以应用bundle identifiercom.atlas.almaz开头且其后最多含一个英文句点“.”(ID:61842dee-99e3-4b65-999b-e782c73179a0)
环境与当前配置
- 环境:Xcode 14.3,Flutter项目
- 主应用Info.plist相关配置:
<key>CFBundleDevelopmentRegion</key> <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleDisplayName</key> <string>Handyman Service User</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
- 已尝试手动指定bundle ID但无效,相关设置截图:
- 基础设置:

- OneSignalNotificationServiceExtension/General设置:

- OneSignalNotificationServiceExtension/Signing&Capabilities设置:

- 基础设置:
解决方案
针对问题1:CFBundleIdentifier冲突
冲突原因是主应用和OneSignal扩展的Bundle ID完全一致,打包后出现重复ID的包。按以下步骤修改:
- 打开iOS目录下的
Runner.xcworkspace - 在Xcode左侧导航栏选中
OneSignalNotificationServiceExtension目标 - 切换到Build Settings标签,搜索
Product Bundle Identifier - 将值改成主应用ID+扩展标识,比如
com.atlas.almaz.OneSignalService(必须和主应用ID不同) - 检查该扩展的
Info.plist,确保CFBundleIdentifier的值是$(PRODUCT_BUNDLE_IDENTIFIER),不要硬编码成主应用的ID
针对问题2:扩展Bundle ID格式违规
苹果要求应用扩展的Bundle ID必须是「主应用ID作为前缀,后面最多加一段(一个英文句点分隔)」。比如主应用ID是com.atlas.almaz,扩展ID可以是com.atlas.almaz.notification,不能是com.atlas.almaz.notification.service。解决步骤:
- 按照问题1的步骤把扩展ID改成合规格式,比如
com.atlas.almaz.onesignal - 确认主应用的
Product Bundle Identifier确实是com.atlas.almaz,保证扩展ID前缀匹配 - 清理缓存:执行
flutter clean,再在Xcode里选Product > Clean Build Folder - 重新打包归档:先跑
flutter build ios --release,再用Xcode归档
额外排查点
- 检查所有Targets的
Product Bundle Identifier,确保没有重复 - 确认所有扩展的
Info.plist里CFBundleIdentifier都用$(PRODUCT_BUNDLE_IDENTIFIER)变量,不要硬编码 - 检查主应用和扩展的Signing & Capabilities,确保Team和Bundle ID对应正确,避免签名配置导致的异常
内容的提问来源于stack exchange,提问作者Daniil
相关产品推荐
相关产品推荐

