当我尝试在模拟器或 iPhone 中执行我的应用程序时,出现下一个错误:
App installation failed
This application or a bundle it contains has the same bundle identifier as this application or another bundle that it contains. Bundle identifiers must be unique.
当我查看设备日志时,我得到了详细的错误消息:
对于 iPhone:
Feb 13 10:28:36 iPhone-de-P streaming_zip_conduit[240] <Warning>: __dispatch_source_read_socket_block_invoke:274:
Failed to install application at file:///var/mobile/Media/PublicStaging/MyApp.app/ :
Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=DuplicateIdentifier,
ErrorDescription=Found bundle at /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.3L3YM3/extracted/MyApp.app/Frameworks/SlideMenuControllerSwift.framework
with the same identifier ($(PRODUCT_BUNDLE_IDENTIFIER)) as bundle at /private/var/mobile/Library/Caches/com.apple.mobile.installd.staging/temp.3L3YM3/extracted/MyApp.app/Frameworks/Serialize.framework}
对于模拟器:
12/2/16 20:40:34,408 com.apple.CoreSimulator.CoreSimulatorService[2426]:
Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=DuplicateIdentifier,
ErrorDescription=Found bundle at /Users/myUserName/Library/Developer/CoreSimulator/Devices/78CD18E0-B8E1-4A95-9224-2EF3ABDE5585/data/Library/Caches/com.apple.mobile.installd.staging/temp.s9Kecf/extracted/MyApp.app/Frameworks/SlideMenuControllerSwift.framework
with the same identifier ($(PRODUCT_BUNDLE_IDENTIFIER)) as bundle at
/Users/myUserName/Library/Developer/CoreSimulator/Devices/78CD18E0-B8E1-4A95-9224-2EF3ABDE5585/data/Library/Caches/com.apple.mobile.installd.staging/temp.s9Kecf/extracted/MyApp.app/Frameworks/Serialize.framework}
在两个设备中都是同样的错误:2 个框架具有相同的 bundle ID
通常我通过在每次编译前执行“pod update”或“pod install”来解决这个错误,但这个解决方案不再有效。
我的项目包含 5 个 pod,这是我的 podfile:
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'swift-serialize'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
pod 'SlideMenuControllerSwift'
end
target 'MyApp' do
end
target 'MyApp' do
end
我没有手动设置任何 pod bundle ID。 pod 的所有配置都是您进行“pod install”时默认设置的配置
此外,给我问题的两个 pod 配置了以下包:
我尝试了所有已发布的解决方案:重置模拟器、删除派生数据、清理产品、清理构建文件夹、删除模拟器并重新安装...
我在 cocoapods 论坛、GitHub 和 Google 中进行了搜索,但我找不到任何关于此错误的引用以及 pods 框架的 bundle ID。
我真的不知道为什么会出现这个错误...所以任何帮助将不胜感激。
最佳答案
最后,错误是每个 pod 的 info.plist 中的 PRODUCT_BUNDLE_IDENTIFIER 字段。将其更改为“org.cocoapods.${PRODUCT_NAME:rfc1034identifier}”解决了问题(以前是“$(PRODUCT_BUNDLE_IDENTIFIER)”)。
关于ios - Xcode 使用 cocoapods 框架找到具有相同标识符的包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35378833/