Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing Cocoapods fails #23935

Closed
f2prateek opened this issue Mar 14, 2019 · 2 comments
Closed

Initializing Cocoapods fails #23935

f2prateek opened this issue Mar 14, 2019 · 2 comments
Labels
Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot. Tool: CocoaPods

Comments

@f2prateek
Copy link

🐛 Bug Report

Running pod init and pod install in a new app fails with the following error:

Analyzing dependencies
[!] The target `{Name}-tvOSTests` is declared twice.

To Reproduce

react-native init CocoaPodsFailingDemo
cd CocoaPodsFailingDemo/ios
pod init
pod install

Expected Behavior

pod install should completely without an error.

Code Example

https://github.com/segmentio/CocoaPodsFailingDemo

Environment

→ react-native info
info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
      Memory: 3.20 GB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.15.1 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28, 8
        Build Tools: 23.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.1 => 0.59.1 
    npmGlobalPackages:
      react-native-cli: 2.0.1

The issue is that the tvOSTests target is generated twice To fix the issue, you have to manually edit the Podfile to remove the duplicate section https://github.com/segmentio/CocoaPodsFailingDemo/pull/1/files.

I'm not 100% sure if this is a React Native issue, or an issue in CocoaPods.

@michalchudziak
Copy link
Contributor

michalchudziak commented Mar 18, 2019

It's related to the fact, that CocoaPods init command is looking for all test targets with app target name.

https://github.com/CocoaPods/CocoaPods/blob/0a92546f76bd1a829a84789707b22c2a183ba1ac/lib/cocoapods/command/init.rb#L69-L70

It means if we have an app called example with targets of example and example-tvOS and test targets of exampleTests and example-tvOSTests, it classifies both test targets as example test targets via (example${any_suffix}) pattern, with tvOS target it works correctly, because only example-tvOSTests conform example-tvOS${any_suffix} pattern.

Possible solutions:

  1. PR to CocoaPods to change the behavior of init command,
  2. Rename tvOS target to some different name, for instance using tvOS prefix instead of a suffix.
  3. Add Podfile to the template to avoid init command ([iOS] Add CocoaPods Podfile to the project template #23563)

Not sure if we are good to go with any of those. We might need to keep deleting the lines from Podfile manually.

@Titozzz
Copy link
Collaborator

Titozzz commented Mar 19, 2019

Will be fixed by #23563! Thanks for the issue 👍

@Titozzz Titozzz closed this as completed Mar 19, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot. Tool: CocoaPods
Projects
None yet
Development

No branches or pull requests

5 participants