App closes on iOS simulator immediately after startup
Your Environment
- Plugin version: 0.5.0-alpha.10
- Platform: iOS
- OS version: 11
- Device manufacturer and model: iOS Simulator
- React Native version: 0.54.2
- Plugin configuration options:
- Link to your project:
Context
On opening the app in the simulator, it immediately closes. The command causing the error appears to be BackgroundGeolocation.start().
Solved the issue. I had left out the permissions for motion tracking in my info.plist, and it was causing the app to crash
Hello @tkalejaiye,
I have the same issue and I have included in Info.plist UIBackgroundModes to location and NSLocationAlwaysUsageDescription to a message, but the app crashes at start. Can you please share what did you have to change in Info.plist to fix this? I have tried UIRequiredDeviceCapabilities with location-services, accelerometer, gyroscope, magnetometer and gps with no results, app always crashes when it initializes BackgroundGeolocation.
EDIT: I'm trying this on simulator (iPhone 7 Plus)
clytras react-native link should do the setup automatically for you. If you're interested which permissions you need, take a look at install script.
https://github.com/mauron85/react-native-background-geolocation/blob/master/scripts/postlink.js#L42
Also mentioned in manual setup instructions:
https://github.com/mauron85/react-native-background-geolocation#ios-setup
Thanks you @mauron85. I'll try and link it with react-native link. I was doing it manually and it looks like I missed something.
@mauron85 I deleted the package from XCode and removed libRCTBackgroundGeolocation.a from Build Phases; then react-native link react-native-mauron85-background-geolocation and a successful link. The crash continued. I then disabled debugging debug: false from the BackgroundGeolocation.configure config and it now works! The crash happens only when I set debug: true and when it calls BackgroundGeolocation.start().
My configuration:
{
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 1, //50,
distanceFilter: 1, //50,
notificationsEnabled: false,
debug: false, // crashes on iOS when set to true
startOnBoot: false,
stopOnTerminate: true,
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
interval: 10000,
fastestInterval: 5000,
activitiesInterval: 10000,
stopOnStillActivity: false,
}
What am I doing wrong? Should I create a new issue?