安装吊舱后如何修复"The target [...] is declared multiple times"?



正在处理一个反应原生(0.59.5版(项目,刚刚安装了cocoapods(1.7.5版(

安装过程:

(从项目目录中(

-sudo gem install cocoapods

(来自项目的iOS目录(

-pod init

-pod install --repo-update

结果:

Analyzing Dependencies[!] The Target 'ProjectName-tvOSTests' is declared multiple times.

然后尝试pod update,导致相同的"分析依赖项"警告。iOS目录中只有一个Podfile和一个"Pods"目录。Pod 目录有三个子目录,它们都是空的。似乎在pod install期间挂断了电话,但我不知道在哪里寻找重复的声明。

我知道您应该在安装 cocoapods 后在 ProjectName.xcworkspace 文件中工作,但我的项目 iOS 目录中没有 .xcworkspace 文件。我该如何解决这个问题?

编辑:

豆荚文件

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'TicTacWHOA' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TicTacWHOA
pod 'Google-Mobile-Ads-SDK'
target 'TicTacWHOA-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'TicTacWHOATests' do
inherit! :search_paths
# Pods for testing
pod 'Google-Mobile-Ads-SDK'
end
end
target 'TicTacWHOA-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TicTacWHOA-tvOS
target 'TicTacWHOA-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end

问题是"目标"在 Podfile 中被声明了两次。 如此简单,就在你面前。我只是什么也没想,因为它是一个完全生成的文件,除了我添加的一行。

您需要做的就是转到 podfile 并在错误中查找代码 例如,我的错误是

[!目标fifty-tvOSTests被多次声明。

现在我已经从 podfile 中删除了这段代码一次。

target 'fifty-tvOSTests' do
inherit! :search_paths
# Pods for testing 
end 

五十是我的项目的名字,你很清楚你的是什么 上面的一段代码在 Podfile 中出现了两次,所以如果你发现多个,请删除,只保留一次

相关内容