import TrackPlayer from 'react-native-track-player';
could not importing TrackPlayer
To solve this I had to do this https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64
Then I restarted the bundler and everything was ok. We could do something like this in lib/index.js on lines 12-14 to catch something like this and provide at least a helpful message:
if (!TrackPlayer) {
console.error("FATAL: FAILED TO LOAD TrackPlayer from NativeModules, did you enable swift in this project? https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64");
}
I had this error on iOS. As @jimthedev mentioned, I went ahead and created the dummy.swift file within Xcode and that fixed it. https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64
I had the same issue earlier today.
I looked at the console output after running react-native run-ios and found some errors, including PCH was compiled with module cache path.... I fixed it by going XCode - Product - Clean and then
running rm -r ios/build.
https://stackoverflow.com/questions/15463179/how-to-fix-pch-error
What if you have the same issue on Android ?
Ok I was missing the Google play services. Now it is working
Most helpful comment
To solve this I had to do this https://github.com/react-native-kit/react-native-track-player/wiki/Installation#ios-library-not-found-for--lswiftcoreaudio-for-architecture-x86_64
Then I restarted the bundler and everything was ok. We could do something like this in lib/index.js on lines 12-14 to catch something like this and provide at least a helpful message: