简体   繁体   English

iOS - watchOS App 发布问题 CFBundleIdentifier 冲突

[英]iOS - watchOS App publishing issue CFBundleIdentifier collision

After the app uploading I receive the following email应用程序上传后,我收到以下电子邮件

We identified one or more issues with a recent delivery for your app, XXX.我们在您的应用 XXX 的最近交付中发现了一个或多个问题。 Please correct the following issues, then upload again.请更正以下问题,然后重新上传。

ITMS-90806: CFBundleIdentifier collision - Each bundle must have a unique bundle identifier. ITMS-90806:CFBundleIdentifier 冲突 - 每个包必须有一个唯一的包标识符。 The bundle identifier 'org.cocoapods.CocoaLumberjack' is used in the bundles '[CocoaLumberjack.framework, CocoaLumberjack.framework]'捆绑包标识符“org.cocoapods.CocoaLumberjack”用于捆绑包“[CocoaLumberjack.framework, CocoaLumberjack.framework]”

CocoaLumberjack is a third party library that I've already used in the past a lot of times without any problem, I am pretty confused. CocoaLumberjack 是一个第三方库,我过去已经使用过很多次了,没有任何问题,我很困惑。

It is not related to the framework's .plist keyword CFBundlePackageType as it is specified in this question/answer Framework CFBundleIdentifier Collision .它与框架的 .plist 关键字 CFBundlePackageType 无关,因为它在此问题/答案Framework CFBundleIdentifier Collision 中指定 The CocoaLumberjack bundle package type is "Framework" (CFBundlePackageType = FMWK). CocoaLumberjack 捆绑包类型是“框架”(CFBundlePackageType = FMWK)。 CocoaLumberjack is a wide used third party library added to my project using cocoapods. CocoaLumberjack 是一个广泛使用的第三方库,使用 cocoapods 添加到我的项目中。

The issue is probably related to the watchOS target in my app bundle.该问题可能与我的应用程序包中的 watchOS 目标有关。 The CocoaLumberjack library is used in both iOS app and watchOS app and it is causing the issue about the bundle identifier duplication. CocoaLumberjack 库在 iOS 应用程序和 watchOS 应用程序中都使用,它导致了有关捆绑标识符重复的问题。

CFBundleIdentifier collision is detected by Apple Connect server if sharing framework between iOS target and Watch Extension.如果在 iOS 目标和 Watch 扩展之间共享框架,Apple Connect 服务器会检测到 CFBundleIdentifier 冲突。

target 'App' do
 platform :ios, '9.0'
 # Pods for App
 ...
 pod 'CocoaLumberjack/Swift', '~> 3.5.3'
 ...
end

target 'AppWatch Extension' do
 platform :watchos, '5.0'
 # Pods for Watch Extension
 ...
 pod 'CocoaLumberjack/Swift', '~> 3.5.3'
 ...
end

The iOS app is using the library and the watchOS extension is using the same library. iOS 应用程序正在使用该库,而 watchOS 扩展正在使用相同的库。 They are using different libraries but CocoaLumberjack is the only one present in both.他们使用不同的库,但 CocoaLumberjack 是两者中唯一存在的库。

I have already published my app a lot of times in the past without any issues with the same libraries configuration.过去我已经发布了很多次我的应用程序,使用相同的库配置没有任何问题。 I guess that the Apple has changed some constraints about bundle identifier in the last few days.我猜苹果在最近几天改变了一些关于捆绑标识符的限制。

The same issue is present also using Carthage.使用 Carthage 也存在同样的问题。

Apparently Apple changed the validation process. 显然Apple改变了验证过程。 It looks like they don't allow to platform specific frameworks within an app to have the same identifier. 看起来他们不允许应用程序中的平台特定框架具有相同的标识符。

There's a post on the forum about this as well: https://forums.developer.apple.com/thread/122048 论坛上还有一篇关于此的帖子: https//forums.developer.apple.com/thread/122048

If you're running into this issue because you're using Cocoapods you could patch your Podfile to append the Platform Name to the bundle identifier so that they'll be always unique ( source ): 如果您因为使用Cocoapods而遇到此问题,则可以修补Podfile以将平台名称附加到包标识符,以便它们始终是唯一的( ):

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}-$(PLATFORM_NAME)'
    end
  end
end

If you have multiple targets in your app you can change the watchOS targets in your scheme in XCode and append .watchos to the identifier as well. 如果您的应用中有多个目标,则可以在XCode中更改方案中的watchOS目标,并将.watchos附加到标识符。

As a temporary workaround I have manually renamed the bundle identifier in the watchOS extension then the app publishing is working fine but it does not look like a nice solution, especially if you are running the build on a CI system. 作为临时解决方法,我在watchOS扩展中手动重命名了bundle标识符,然后app发布工作正常,但它看起来不是一个好的解决方案,特别是如果你在CI系统上运行构建。

A better option is to add a specific post install operation in pod file: 更好的选择是在pod文件中添加特定的安装后操作:

post_install do |installer|
 installer.pods_project.targets.each do |target|
  if target.name == 'CocoaLumberjack-watchOS'
   target.build_configurations.each do |config|       
    config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}-$(PLATFORM_NAME)'
   end
  end
 end
end

or if you have to handle multiple libraries: 或者如果你必须处理多个库:

post_install do |installer|
 watchosLibs = ['Lib1-watchOS', 'Lib2-watchOS', 'Lib3-watchOS']
 installer.pods_project.targets.each do |target|
  if watchosLibs.include? target.name
   target.build_configurations.each do |config|
    config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}.${PLATFORM_NAME}"
   end
  end
 end
end

Pay attention to rename pods bundle identifier because some libraries don't behave correctly otherwise. 请注意重命名pods bundle标识符,因为否则某些库的行为不正确。

I suggest to rename only the libraries rejected by Apple in order to minimize the possible issues. 我建议只重命名Apple拒绝的库,以尽量减少可能出现的问题。

Currently there are some different open threads about this issue: 目前关于此问题有一些不同的开放主题:

A similar issue is present also using Carthage instead of Cocoapods 使用Carthage代替Cocoapods也存在类似的问题

If Apple will not change this new policy about bundle identifier then a more clean solution will probably come from cocoapods team. 如果Apple不会更改关于捆绑标识符的新政策,那么更干净的解决方案可能来自cocoapods团队。

You don't need to change every target, its cleaner to write something like this: 你不需要改变每个目标,它更清晰,写这样的东西:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.platform_name == :watchos
      target.build_configurations.each do |config|
        config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}-$(PLATFORM_NAME)'
      end
    end
  end
end

Here is how I've worked around the problem for Carthage. 以下是我为迦太基解决问题的方法。

1) create a Carthage build script that separates out the different Carthage build phases 1)创建一个Carthage构建脚本,分离出不同的Carthage构建阶段

2) when you do the actual framework builds; 2)当你做实际的框架构建时; first build the problem frameworks for iOS (I only had one), then modify your project files to change the bundle identifier, then build those frameworks for watchOS, then build the rest of your frameworks 首先构建iOS的问题框架(我只有一个),然后修改项目文件以更改bundle标识符,然后为watchOS构建那些框架,然后构建其余的框架

carthage bootstrap --no-checkout
carthage checkout
#undo previous CFBundleIdentifier changes
sed -i '' 's/com.someco.MyFramework.watchOS;/com.someco.MyFramework;/g' Carthage/Checkouts/MyFramework/MyFramework.xcodeproj/project.pbxproj
carthage build --cache-builds --platform iOS
#set a unique CFBundleIdentifier
sed -i '' 's/com.someco.MyFramework;/com.someco.MyFramework.watchOS;/g' Carthage/Checkouts/MyFramework/MyFramework.xcodeproj/project.pbxproj
carthage build --no-use-binaries --platform watchOS --configuration $CONF $VERBOSE MyFramework

一种选择是 - 您可以手动将“ .watchos(abc.asd.alomofire.watchos )添加到手表包标识符中。

Just remove the embed frameworks build phase from your extension. 只需从您的扩展中删除嵌入框架构建阶段即可。

Click on extension in target section -> Build phases -> remove the embed pods frameworks 单击目标部分中的扩展 - >构建阶段 - >删除嵌入窗格框架

See attached picture: 见附图: 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS-watchOS App ITMS-90806:CFBundleIdentifier碰撞Alamofire - iOS - watchOS App ITMS-90806: CFBundleIdentifier collision Alamofire CFBundleIdentifier冲突 - CFBundleIdentifier Collision 提交 iOS 应用程序时 watchOS 应用程序出现问题 - Issue with watchOS app when submit iOS app 在App Store上发布NativeScript应用程序时CFBundleIdentifier Collision等 - CFBundleIdentifier Collision and more when publising NativeScript app on App Store iOS 验证存档因 CFBundleIdentifier 冲突和无效捆绑包失败 - iOS Validate archive failed with CFBundleIdentifier Collision & Invalid Bundle 使用CFBundleIdentifier找到iOS应用目录 - Locate an iOS app directory using a CFBundleIdentifier 框架 CFBundleIdentifier 冲突 - Framework CFBundleIdentifier Collision cocoapods框架的nativescript iOS应用发布问题 - nativescript iOS app publishing issue with cocoapods frameworks 发布中iPhone和iPad的iOS应用兼容性问题 - iOS app compatibility issue with iphone and ipad in Publishing 错误ITMS-90685:CFBundleIdentifier冲突。 CFBundleIdentifier值'xamarin.ios.xamarin-framework'不止一个捆绑包 - ERROR ITMS-90685: CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'xamarin.ios.xamarin-framework'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM