react-native-track-player: [iOS] The Swift pod `react-native-track-player` depends upon `React`, which do not define modules.
Hi,
I followed the instruction on [https://react-native-kit.github.io/react-native-track-player/api/]
After execution react-native link, I got a message that successfully linked.
But, while running on iOS emulator, there is an error message that “native module cannot be null”.
So, I go to ios folder and ran pod install. But, I got an error message
Using boost-for-react-native (1.63.0) Using glog (0.3.5) Installing react-native-track-player (1.1.3) Using yoga (0.58.6.React) [!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod react-native-track-player depends upon React, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.
After that, I coulnd’t running emaultor and build fails.
Any tips?
package.json
{
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.58.6",
"react-native-gesture-handler": "^1.1.0",
"react-native-swift": "^1.2.2",
"react-native-track-player": "^1.1.3",
"react-native-unimodules": "0.2.0",
"react-navigation": "^3.5.1"
},
"devDependencies": {
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
},
"private": true,
"isSwift": true
}
react-native info
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 23.37 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 11.11.0 - /usr/local/bin/node
npm: 6.9.0 - /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: 10, 11, 12, 13, 25, 26, 27, 28
Build Tools: 27.0.3, 28.0.3, 29.0.0
System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-Q | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.6.3 => 16.6.3
react-native: 0.58.6 => 0.58.6
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native-snap-carousel: 3.6.0
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 21
If you are not using Expo, Using pods and get this error, adding
use_modular_headers!to top of Podfile works.@waqas19921 thanks!
Just to make it clear:
node_modules/react-native-track-player/react-native-track-player.podspecs.exclude_files = ["ios/RNTrackPlayer/Vendor/AudioPlayer/Example"]yourapp/ios/Podfilepod 'React', :path => '../node_modules/react-native', :modular_headers => trueI’ve applied those changes but have now an error on a different 3rd partie (react-native-image-crop-picker) that was building ok before those changes but cannot compile with the modular_headers thing. I’ve reacted to their issue here: https://github.com/ivpusic/react-native-image-crop-picker/issues/1132
The error I am getting is
Definition of 'RCTBridge' must be imported from module 'React.React.RCTBridge' before it is requiredSo we are in a catch 22 situation where we need to choose between this library and the other one. Do you have a less instrusive solution to our issue than
:modular_headers ==> true?just add use_modular_headers! in Podfile it will fix the issue