react-native-background-geolocation: `Undefined symbols: _OBJC_CLASS_$_TSBackgroundFetch` when compiling with Rosetta 2 Xcode to x86 iOS Simulator
Your Environment
- Plugin version: 4.13.2
- Platform: iOS
- OS version: iOS 17.3
- Device manufacturer / model: iOS Simulator
- React Native version (
react-native -v): 0.68.2 - Plugin config
not relevant
Expected Behavior
Compilation to succeed
Actual Behavior
Compilation fails on link step
Steps to Reproduce
- use an Apple Silicon Mac
bundle exec pod repo update && bundle exec pod installarch -x86_64 /Applications/Xcode.app/Contents/MacOS/Xcode- set target to an iOS Simulator device (e.g. iPad)
- click Run
Context
- I’m trying to use the package with x86 iOS Simulator through Rosetta 2.
- The package compiles fine when building from Arm to Arm (Apple Silicon Mac to iPhone).
- Tried both
arch -x86_64 bundle exec pod repo update && arch -x86_64 bundle exec pod installandbundle exec pod repo update && bundle exec pod install- same error. - clean build doesn’t help
use_frameworks!is NOT used- we can’t use Arm iOS Simulator unfortunately because other packages are broken in it.
Debug logs
Logs
ld: warning: ignoring duplicate libraries: '-lc++', '-lsqlite3', '-lz'
ld: warning: ignoring file '/Users/ilia/stqry/stqry-rn/node_modules/react-native-background-fetch/ios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_armv7/TSBackgroundFetch.framework/TSBackgroundFetch': fat file missing arch 'x86_64', file has 'arm64,armv7'
ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
ld: Undefined symbols:
_OBJC_CLASS_$_TSBackgroundFetch, referenced from:
in RNBackgroundFetch+AppDelegate.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 21 (14 by maintainers)
Unfortunately, RN doesn’t auto-link transitive dependencies of a plugin.
even though background-fetch is declared as a dependency within package.json, you’re forced to manually
yarn addit in order for it to be auto-linked.@christocracy oh I see,
RNBackgroundFetch+AppDelegate.mis deprecated, not fully removed. I added it back and the build still works!It looks like merely doing
yarn add react-native-background-fetch@^4.2.1is enough.Thank you!
Ok, got it to work too. Seems like
RNBackgroundFetch+AppDelegate.mis not (no longer?) needed andreact-native-background-fetchhas to be present inpackage.json.I removed it since it’s not needed for newer version of RN
@noway How were you able to compile at all, I am also having this issue and I can’t seem to compile both on my physical device and simulator.
I’ll have a look at xcframework build-script.