簡體   English   中英

Xcode 使用 cocoapods 框架找到具有相同標識符的包

[英]Xcode found bundle with the same identifier using cocoapods frameworks

當我嘗試在模擬器或 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

我沒有手動設置任何 pods 包 ID。 Pod 的所有配置都是在進行“Pod 安裝”時默認設置的配置

另外,給我出問題的兩個pods配置了如下bundle:

幻燈片菜單窗格: 在此處輸入圖片說明

序列化 Pod: 在此處輸入圖片說明

這是我的項目包配置: 在此處輸入圖片說明

我嘗試了所有發布的解決方案:重置模擬器,刪除派生數據,產品清理,清理構建文件夾,刪除模擬器並重新安裝......

我在 cocoapods 論壇、GitHub 和 Google 中進行了搜索,但我無法通過 pods 框架的捆綁 ID 找到任何對此錯誤的引用。

我真的不知道為什么會發生這個錯誤......所以任何幫助都將不勝感激。

最后,錯誤是每個 pod 的 info.plist 中的 PRODUCT_BUNDLE_IDENTIFIER 字段。 將其更改為“org.cocoapods.${PRODUCT_NAME:rfc1034identifier}”解決了問題(以前是“$(PRODUCT_BUNDLE_IDENTIFIER)”)。

對我來說,從菜單中選擇 Product > Clean in Xcode 並再次運行!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM