Cocoapodstesting问题 – 重复“两个之一将被使用。 哪一个是不确定的。“

我一直在试图解决这个问题几天,还没有find解决办法。 每当我尝试运行一个testing,我收到下面显示的错误,有重复的类。

我试过这些答案,但我仍然收到重复的错误,我的testing将无法运行

Cocoapods警告 – CocoaPods没有设置你的项目的基本configuration,因为你的项目已经有一个自定义的configuration集

我的pod文件如下所示:

platform :ios, "8.0" def project_pods pod "Braintree" pod "AFNetworking", "~> 3.0" pod "MBProgressHUD" pod "ActionSheetPicker-3.0", "~> 2.0.1" pod "SCLAlertView-Objective-C", "~> 0.7" pod "GoogleMaps" pod "MPSHorizontalMenu" pod "Fabric" pod "Crashlytics" pod "RateView" pod "QBImagePickerController" pod "GLCalendarView", "~> 1.0.0" pod "Heap" pod "AWSS3" end target “iOS_project” do project_pods end target “iOS_projectTests” do project_pods end 

这是错误的样子,这是每个cocoapod类:

GMSAutocompleteResultsViewController类实现在/Users/john/Library/Developer/CoreSimulator/Devices/27CF0470-07AC-4575-8907-A27EE9B357A7/data/Containers/Bundle/Application/7AFB0886-9ED1-464D-8B02-067CDD07511D/iOS_project.app / iOS_project和/Users/john/Library/Developer/Xcode/DerivedData/iOS_projectTests-hezbkjqviaiitthcrrnwetvcojcb/Build/Products/Debug-iphonesimulator/iOS_projectTests.xctest/iOS_projectTests。 将使用两者之一。 哪一个是未定义的

所有的豆荚都是Objective C,我正在使用一个桥接头

重新格式化你的podfile像这样:

 platform :ios, "8.0" def project_pods pod "Braintree" pod "AFNetworking", "~> 3.0" pod "MBProgressHUD" pod "ActionSheetPicker-3.0", "~> 2.0.1" pod "SCLAlertView-Objective-C", "~> 0.7" pod "GoogleMaps" pod "MPSHorizontalMenu" pod "Fabric" pod "Crashlytics" pod "RateView" pod "QBImagePickerController" pod "GLCalendarView", "~> 1.0.0" pod "Heap" pod "AWSS3" target "iOS_projectTests" do inherit! :search_paths end end target "iOS_project" do project_pods end 

来源: CocoaPods问题#4626

现在,通过评论“use_frameworks!”修改Podfile ,如下所示:

平台:ios,'8.0'

#use_frameworks!

目标'十八'呢

 pod 'SDWebImage' pod 'AFNetworking' pod 'MBProgressHUD' pod 'MJRefresh', '3.1.0' pod 'UMengAnalytics' pod 'YYModel' pod 'AMapLocation' pod 'pop' 

结束

该错误指示'GMSAutocompleteResultsViewController'被集成两次,只有一个被使用

如果您现在没有使用unit testing用例,则可以从podfile中删除该部分,然后再通过pod installpod update

从您的podfile中删除这部分

 target “iOS_projectTests” do project_pods end 

对于swift来说,如果你设置use_frameworks!就会很好use_frameworks! 低于平台版本

所以你的顶部可以像

 platform :ios, "8.0" use_frameworks! 

所以你的新的podfile可以看起来像这样

 platform :ios, "8.0" use_frameworks! def project_pods pod "Braintree" pod "AFNetworking", "~> 3.0" pod "MBProgressHUD" pod "ActionSheetPicker-3.0", "~> 2.0.1" pod "SCLAlertView-Objective-C", "~> 0.7" pod "GoogleMaps" pod "MPSHorizontalMenu" pod "Fabric" pod "Crashlytics" pod "RateView" pod "QBImagePickerController" pod "GLCalendarView", "~> 1.0.0" pod "Heap" pod "AWSS3" end target “iOS_project” do project_pods end target “iOS_projectTests” do project_pods end 

希望这有助于,如果它仍然显示错误,你可以把豆荚直接放在目标上,而不是放在顶部

注意:对于Google地图,您还可以直接导入框架,如import GoogleMaps而不是在桥接标头中添加Google地图