【问题标题】:Xcode found bundle with the same identifier using cocoapods frameworksXcode 使用 cocoapods 框架找到具有相同标识符的包
【发布时间】:2016-05-24 13:27:36
【问题描述】:

当我尝试在模拟器或 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 个框架具有相同的捆绑 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 捆绑 ID。 pod 的所有配置都是在您进行“pod install”时默认设置的配置

此外,给我带来问题的两个 pod 配置了以下捆绑包:

SlideMenu Pod:

序列化 Pod:

这是我的项目捆绑配置:

我尝试了所有发布的解决方案:重置模拟器、删除派生数据、清理产品、清理构建文件夹、删除模拟器并重新安装...

我在 cocoapods 论坛、GitHub 和 Google 中进行了搜索,但在 pods 框架的捆绑包 ID 中找不到任何关于此错误的参考。

我真的不知道为什么会出现这个错误...所以任何帮助将不胜感激队友。

【问题讨论】:

    标签: ios xcode swift ios-simulator cocoapods


    【解决方案1】:

    最后错误是每个 pod 的 info.plist 中的 PRODUCT_BUNDLE_IDENTIFIER 字段。将其更改为“org.cocoapods.${PRODUCT_NAME:rfc1034identifier}”解决了问题(以前是“$(PRODUCT_BUNDLE_IDENTIFIER)”)。

    【讨论】:

      【解决方案2】:

      对我来说,从菜单中选择 Product > Clean in Xcode 并再次运行!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-10-10
        • 2019-03-03
        • 2016-05-21
        • 2017-01-17
        • 1970-01-01
        • 2019-07-31
        • 2014-11-23
        相关资源
        最近更新 更多