6

在 react-native(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”目录。pods 目录有三个子目录,它们都是空的。期间似乎出现了挂断,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
4

2 回答 2

16

问题是“目标”在 Podfile 中被声明了两次。如此简单,可能就在您的面前。我只是没有想到它,因为它是一个完全生成的文件,除了我添加的一行。

于 2019-09-16T22:46:57.290 回答
5

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

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

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

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

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

于 2020-01-30T12:00:55.583 回答