You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode归档验证失败:CFBundleIdentifier冲突与格式错误求助

Flutter项目Transporter上传归档文件的Bundle ID问题解决办法

问题描述

  1. Asset validation failed CFBundleIdentifier Collision:iOS应用Runner.app下存在多个CFBundleIdentifier值为com.atlas.almaz的包(ID:52b4c9ca-b0cf-432b-b112-51a2d228270e)
  2. Asset validation failed Bad bundle identifier:应用扩展Runner.app/PlugIns/OneSignalNotificationServiceExtension.appex的bundle identifier com.atlas.almaz不符合规则,需以应用bundle identifier com.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设置:OneSignal扩展General设置
    • OneSignalNotificationServiceExtension/Signing&Capabilities设置:OneSignal扩展签名设置

解决方案

针对问题1:CFBundleIdentifier冲突

冲突原因是主应用和OneSignal扩展的Bundle ID完全一致,打包后出现重复ID的包。按以下步骤修改:

  1. 打开iOS目录下的Runner.xcworkspace
  2. 在Xcode左侧导航栏选中OneSignalNotificationServiceExtension目标
  3. 切换到Build Settings标签,搜索Product Bundle Identifier
  4. 将值改成主应用ID+扩展标识,比如com.atlas.almaz.OneSignalService(必须和主应用ID不同)
  5. 检查该扩展的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. 按照问题1的步骤把扩展ID改成合规格式,比如com.atlas.almaz.onesignal
  2. 确认主应用的Product Bundle Identifier确实是com.atlas.almaz,保证扩展ID前缀匹配
  3. 清理缓存:执行flutter clean,再在Xcode里选Product > Clean Build Folder
  4. 重新打包归档:先跑flutter build ios --release,再用Xcode归档

额外排查点

  • 检查所有Targets的Product Bundle Identifier,确保没有重复
  • 确认所有扩展的Info.plist里CFBundleIdentifier都用$(PRODUCT_BUNDLE_IDENTIFIER)变量,不要硬编码
  • 检查主应用和扩展的Signing & Capabilities,确保Team和Bundle ID对应正确,避免签名配置导致的异常

内容的提问来源于stack exchange,提问作者Daniil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 07:50:09