React Native iOS pod 设置有重复目标问题

React Native iOS pod setup has duplicate target issue

我正在使用 React Native 构建应用程序,我必须将 pod 依赖项添加到我的项目中。我关注了 tutorial 如何使用全新的 react-native init 项目初始化 pod。这是我的 Podfile 的内容:

target 'MyProject' do

  target 'MyProject-tvOSTests' do
    inherit! :search_paths
  end

  target 'MyProjectTests' do
    inherit! :search_paths
  end

end

target 'MyProject-tvOS' do

  target 'MyProject-tvOSTests' do
    inherit! :search_paths
  end

end

然后我 运行 pod install,我得到这个错误:

The target MyProject-tvOSTests is declared twice.

我认为这是 react-native init 的问题,但我不知道如何更正它。

提前致谢!

您的 MyProject-tvOSTests 目标重复。删除它的第一个实例。

target 'MyProject' do

  target 'MyProjectTests' do
    inherit! :search_paths
  end

end

target 'MyProject-tvOS' do

  target 'MyProject-tvOSTests' do
    inherit! :search_paths
  end

end