react-native-background-geolocation
react-native-background-geolocation copied to clipboard
`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)
I can reproduce this on version 4.14.6 of react-native-background-geolocation as well.
I'll have a look at xcframework build-script.
This issue is stale because it has been open for 30 days with no activity.
This issue is not stale and still affects us.
@christocracy sorry for bugging you, but is there any way to get this fixed? We use Rosetta 2 iOS Simulator on our Apple Silicon machines to create screenshots. We can't use ARM64 iOS Simulator since some of our other react-native packages are broken on ARM64 iOS Simulator. But on Rosetta 2 iOS Simulator, only react-native-background-geolocation is broken.
It's a big workflow friction point for us.
@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.
@akinlekan28 youre using Rosetta 2?
@akinlekan28 youre using Rosetta 2?
Yes
How are you running with Rosetta 2? I'm able to launch my demo app in a simulator iPhone 15 Pro (Rosetta, 17.2).
How are you running with Rosetta 2? I'm able to launch my demo app in a simulator iPhone 15 Pro (Rosetta, 17.2).
![]()
@akinlekan28 what's your React Native version?
@christocracy I'm opening Xcode and selecting a Rosetta simulator.
Here's my Xcode:
I'm using React Native 0.70.15 at the moment.
@akinlekan28 what's your React Native version?
@christocracy I'm opening Xcode and selecting a Rosetta simulator.
Here's my Xcode:
I'm using React Native 0.70.15 at the moment.
0.74.1
@akinlekan28 do you have __apply_Xcode_12_5_M1_post_install_workaround enabled in your Podfile?
@akinlekan28 do you have
__apply_Xcode_12_5_M1_post_install_workaroundenabled in your Podfile?
I removed it since it's not needed for newer version of RN
I updated to XCode 15.4. Demo App runs fine with Simulator iPhone 15 Pro (Rosetta, 17.4).
I suggest you try testing in a freshly generated, simple hello-world.
I updated to XCode 15.4. Demo App runs fine with Simulator iPhone 15 Pro (Rosetta, 17.4).
I suggest you try testing in a freshly generated, simple hello-world.
![]()
I've been able to get this to work on both the simulator and physical device. I had to create a new app though.
Ok, got it to work too. Seems like RNBackgroundFetch+AppDelegate.m is not (no longer?) needed and react-native-background-fetch has to be present in package.json.
Seems like RNBackgroundFetch+AppDelegate.m is not (no longer?)
and react-native-background-fetch has to be present in package.json.
As directed by the Setup Instructions
@christocracy oh I see, RNBackgroundFetch+AppDelegate.m is 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.1 is enough.
Thank you!
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 add it in order for it to be auto-linked.

Here's my Xcode:
I'm using React Native 0.70.15 at the moment.