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 个框架具有相同的 bundle ID

通常我通过在每次编译前执行 "pod update" 或 "pod install" 来解决这个错误,但是这个解决方案不再有效了。

我的项目包含 5 个 pods,这是我的 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。 pods的所有配置都是你做"pod install"

时默认设置的那些

另外,给我出问题的两个pods配置了如下bundle:

SlideMenu 窗格:

序列化 Pod:

这是我的项目包配置:

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

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

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

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

对我来说,从菜单中选择 Xcode 中的“产品”>“清洁”,运行 再次起作用!