question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No way to use npm package if it uses Native lib supported in iOS but not tvOS

See original GitHub issue

Version: "react-native": "npm:react-native-tvos@0.60.4-6",

When I want to use some library that is supported by iOS but not tvOS, for example react-native-webview, I am unable to build tvOS anymore.

Steps To Reproduce

  1. yarn add react-native-webview
  2. cd ios && pod install

Expected: pod installs for iOS but not for tvOS

Actual pod install attempts to install for tvOS and throws fatal error, blocker

[!] The platform of the target `MyApp-tvOS` (tvOS 9.2) is not compatible with `react-native-webview (7.2.5)`, which does not support `tvos`.
error Command failed with exit code 1.

Attempted workarounds:

  1. tried editing the .podspec from the library to support the tvOS target: s.platforms = { :ios => "9.0" } --> s.platforms = { :ios => "9.0", :tvos => "9.2" }

this allowed me to install the pod. but then i encountered fatal errors, because this lib uses webkit and webkit/webviews is not supported by tvOS

Desired solution: Is there a way to change the Podfile so that the tvOS target section can “exclude” an autolinked pod form node_modules?

If we can’t do this, then we would be forced to only use libraries which are supported by both iOS and tvOS, which is not great.

Snapshot of my Podfile

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'MyApp' do
  platform :ios, '9.0'
  # Pods for MyApp
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'


  use_native_modules!

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'MyApp-tvOS' do
  platform :tvos, '9.2'

  # Pods for MyApp-tvOS
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  use_native_modules!

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

end

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
douglowdercommented, Oct 2, 2019

I think the problem is the use_native_modules! line. That is going to try to automatically pick up any NPM dependencies that have native modules.

If you take that out, and put in a pod line for the iOS target that explicitly pulls in react-native-webview pod, that should solve the issue.

2reactions
aakashsigdelcommented, Oct 22, 2019

@octopicorn any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No way to use npm package if it uses Native lib supported in ...
When I want to use some library that is supported by iOS but not tvOS, for example react-native-webview , I am unable to...
Read more >
react-native-tvos - npm
A framework for building native apps using React. Latest version: 0.69.6-0, last published: a month ago. Start using react-native-tvos in ...
Read more >
Using Libraries - React Native
This guide introduces React Native developers to finding, installing, and using third-party libraries in their apps.
Read more >
Firebase Apple SDK Release Notes - Google
Bitcode is no longer included in Firebase binary distributions. Xcode 14 does not support bitcode. tvOS apps using a Firebase binary distribution will...
Read more >
How to Create Apple TV Application with React Native
The react-native-tvos NPM package should be used to create React Native ... Create App ( if you are not using global CLI, use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found