React-native: React Native link adds tvOS library targets to the ios target

Created on 4 May 2017  Â·  21Comments  Â·  Source: facebook/react-native

Description

In adding a tvOS target to the react-native-vector-icons library, react-native link inadvertently adds the tvOS target to the normal ios target causing the app to fail to run

Reproduction Steps and Sample Code

Described here: https://github.com/oblador/react-native-vector-icons/issues/461

Solution

React Native link needs to properly link the ios and tvOS library targets with the right target

Additional Information

  • React Native version: 0.44
  • Platform: iOS
  • Development Operating System: MacOS
  • Dev tools: XCode 8.3.2
Locked

Most helpful comment

Hi, do we need to have tvOS? How do we remove it from the project?

All 21 comments

Ah, bummer. react-native link can sometimes be clumsy, cc @grabbou who knows more about it

Also perhaps @Kureev?

I have the same problem, I had to remove -lRNVectorIcons-tvOS manually from Xcode, in order to make it work.

The issue is in this code https://github.com/facebook/react-native/blob/master/local-cli/link/ios/registerNativeModule.js#L36-L40

It calls getProducts that returns an array of all products (the array will typically have two items tvOS and iOS targets) and adds them to getFirstTarget().

We need to handle those things in a way that we link tvOS with tvOS and iOS with iOS (and other targets in the future as well).

I'll be looking into that later this week - if anyone wants to start earlier, you can hit me up on slack.callstack.io and will be happy to help.

I am starting work on this issue and hopefully a nice solution lands soon :)

FYI: I have been working on this for past two weeks from time to time - the issue turned out to be quite complex and requires few changes to link and unlink philosophy. I keep posting updates here.

Im stuck with this. ANy help?

Hi, do we need to have tvOS? How do we remove it from the project?

@grabbou any update on this? Is there anything I can do to help?

Yeah! Would love to pair and brainstorm few ideas out - do you think we could follow up on Slack and get this done? It's going to be a big rewrite of internals but it's quite needed.

@dlowder-salesforce were you still planning to extract tvOS to be hosted out of tree?

@matthargett extracting tvOS is something that can hopefully be done eventually, but will take some time. For now, I'm just planning to fix the tvOS-specific issues, and work with @grabbou on cleaning up the CLI internals.

@dlowder-salesforce what as a user do I need to do to get this fix? (great Chain React video btw)

@TheoGit this worked for me: https://github.com/rebeccahughes/react-native-device-info/issues/258#issuecomment-340434729

replace libRNDeviceInfo-tvOS.a with whatever lib is causing your build to fail

@ankitdesai I just got it to work - thanks! @dlowder-salesforce I have the simulator running now and look forward to having created an Apple TV App with React Native

@TheoGit thanks for the kind words.... to get my fix directly you can use

"react-native": "https://github.com/dlowder-salesforce/react-native#tvos-cli-link-fix-2",

in your package.json, or you can wait for this branch to get merged to a release version.

@dlowder-salesforce thanks! I'm working on a big project and will visiting often - I also saw the rn-tvos-example-2048 project if you think that will help

@dlowder-salesforce any idea when this branch will merge?

@grabbou will be reviewing the PR for this shortly.

To everyone else who is lading here and doesn't see answer on how to solve this.

You can manually delete library-tvOS.a in Xcode -> [Your iOS build target] -> Build Phrases -> Link Binary with Libraries.

Or, manually add it if it wasn't added by link (this is literally what we
just stumbled upon internally)

On Tue, 5 Feb 2019 at 15:26 Kapil Gorve notifications@github.com wrote:

To everyone else who is lading here and doesn't see answer on how to solve
this.

You can manually delete library-tvOS.a in Xcode -> [Your iOS build target]
-> Build Phrases -> Link Binary with Libraries.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/13783#issuecomment-460655900,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWcxjqCOYbfZWubRiT_hXiA1SSoZMqGks5vKZSdgaJpZM4NQ_89
.

Was this page helpful?
0 / 5 - 0 ratings