iOS-watchOS App发布问题CFBundleIdentifier冲突 [英] iOS - watchOS App publishing issue CFBundleIdentifier collision

查看:341
本文介绍了iOS-watchOS App发布问题CFBundleIdentifier冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用上传后,我收到以下电子邮件

After the app uploading I receive the following email


我们发现您的应用最近交付$ b时出现一个或多个问题$ b XXX。请更正以下问题,然后重新上传。

We identified one or more issues with a recent delivery for your app, XXX. Please correct the following issues, then upload again.

ITMS-90806:CFBundleIdentifier冲突-每个捆绑包必须具有
个唯一的捆绑包标识符。捆绑包标识符
'org.cocoapods.CocoaLumberjack'用于捆绑包
'[CocoaLumberjack.framework,CocoaLumberjack.framework]'

ITMS-90806: CFBundleIdentifier collision - Each bundle must have a unique bundle identifier. The bundle identifier 'org.cocoapods.CocoaLumberjack' is used in the bundles '[CocoaLumberjack.framework, CocoaLumberjack.framework]'

CocoaLumberjack是我过去已经使用了很多次而没有任何问题的第三方库,我感到很困惑。

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.

它与框架的.plist关键字CFBundlePackageType
无关,因为此问题/答案 Framework CFBundleIdentifier碰撞。 CocoaLumberjack捆绑包的类型为框架(CFBundlePackageType = FMWK)。 CocoaLumberjack是使用cocoapods添加到我的项目中的广泛使用的第三方库。

It is not related to the framework's .plist keyword CFBundlePackageType as it is specified in this question/answer Framework CFBundleIdentifier Collision. The CocoaLumberjack bundle package type is "Framework" (CFBundlePackageType = FMWK). CocoaLumberjack is a wide used third party library added to my project using cocoapods.

问题可能与我的应用捆绑包中的watchOS目标有关。
CocoaLumberjack库同时在iOS应用程序和watchOS应用程序中使用,并引起捆绑标识符重复的问题。

The issue is probably related to the watchOS target in my app bundle. The CocoaLumberjack library is used in both iOS app and watchOS app and it is causing the issue about the bundle identifier duplication.

CFBundleIdentifier冲突由Apple Connect检测到

CFBundleIdentifier collision is detected by Apple Connect server if sharing framework between iOS target and Watch Extension.

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

iOS应用正在使用该库和watchOS扩展正在使用相同的库。他们使用不同的库,但CocoaLumberjack是两者中唯一的库。

The iOS app is using the library and the watchOS extension is using the same library. They are using different libraries but CocoaLumberjack is the only one present in both.

过去,我已经多次发布我的应用程序,而相同的库没有任何问题组态。我想苹果在最近几天已经改变了一些关于捆绑标识符的限制。

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.

推荐答案

作为一种临时解决方法,我在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.

更好的选择是在pod文件中添加特定的安装后操作:

A better option is to add a specific post install operation in pod file:

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

请注意重命名pods bundle标识符,因为某些库的行为否则会不正确。

Pay attention to rename pods bundle identifier because some libraries don't behave correctly otherwise.

我建议仅重命名Apple拒绝的库,以最大程度地减少可能出现的问题。

I suggest to rename only the libraries rejected by Apple in order to minimize the possible issues.

目前有一些与此问题有关的开放线程:

Currently there are some different open threads about this issue:

  • On Apple forum (currently no more available)
  • On Cocoapods github project

使用迦太基也存在类似的问题而不是可可足类

A similar issue is present also using Carthage instead of Cocoapods

  • On Carthage github project

如果Apple不会更改有关捆绑标识符的新政策,那么可以采用一种更为干净的解决方案可能来自cocoapods团队。

If Apple will not change this new policy about bundle identifier then a more clean solution will probably come from cocoapods team.

这篇关于iOS-watchOS App发布问题CFBundleIdentifier冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆