react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

App closes on iOS simulator immediately after startup

Open tkalejaiye opened this issue 8 years ago • 6 comments

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().

tkalejaiye avatar Mar 14 '18 17:03 tkalejaiye

Solved the issue. I had left out the permissions for motion tracking in my info.plist, and it was causing the app to crash

tkalejaiye avatar Mar 15 '18 11:03 tkalejaiye

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 avatar Oct 29 '18 14:10 clytras

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

mauron85 avatar Oct 29 '18 15:10 mauron85

Also mentioned in manual setup instructions:

https://github.com/mauron85/react-native-background-geolocation#ios-setup

mauron85 avatar Oct 29 '18 15:10 mauron85

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.

clytras avatar Oct 29 '18 16:10 clytras

@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?

clytras avatar Oct 29 '18 18:10 clytras