When trying to start the geolocation, the app crashes without any message, error handling or anything else.
cordova -v): newest (already reinstalled)cordova platform ls): newest (already reinstalled)Im just calling the start method with all granted permissions.
When starting the app, it crashes instantly after calling BackgroundGeolocation.start();
I麓ve tried everything but ios debugging with javascript, cordova and ionic is like hell.
Thus im trying to fix that issue with your help, to see if there are any methods to avoid this crash.
The ionicerrorhandler isn麓t even called, because that should normally send a report to sentry (what it doesn麓t do)
Things i麓ve tried:
P.S. on android everything works fine.
The code im using:
BackgroundGeolocation.configure({
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 1,
distanceFilter: 30,
interval: 1000,
fastestInterval: 1000,
activitiesInterval: 1000,
saveBatteryOnBackground: true,
maxLocations: 1,
activityType: "AutomotiveNavigation",
debug: false,
});
this.startGettingLocations(); // registers an "on('location')" listener
await this.log("Configure Done"); // pops up
BackgroundGeolocation.start(); // Crashes
await this.log("Background location started.");
The Geolocator should start...
Crash
/
Already tried many different things, and after a week trying to debug with mac os (virtually, dedicated, physically, virtualbox) im trying this way
No logs.
If you need any more information: im going to provide it asap.
I'm running into this situation as well. Android works fine, but iOS crashes. Are you getting any messages within XCode when the app fails?
Mine is retuning the following:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull intValue]: unrecognized selector sent to instance 0x1db647e28'
hi there,
i managed to fix the issue above by setting alle correct Information in the plist file.
I debugged it with xcode, that worked very well.
Im not using thhe config settings of the plugin and wrote it in the config xml by myself
So i think your issue isnt related to this issue
Would you provide us with your solution please instead of just simply closing this thread without helping others?
As already mentioned above, setting the information via config.xml worked.
If somebody is facing the same issue, the first approach should be debugging the app with XCode directly.
But i set the config things like shown below
<config-file parent="NSBluetoothAlwaysUsageDescription" platform="ios" target="*-Info.plist">
<string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string>
</config-file>
<config-file parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist">
<string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string>
</config-file>
<config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
<string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string>
</config-file>
<config-file parent="NSMotionUsageDescription" platform="ios" target="*-Info.plist">
<string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string>
</config-file>
I'm still getting this error with this config:
<config-file parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist">
<string>La app requiere saber tu ubicaci贸n todo el tiempo</string>
</config-file>
<config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
<string>La app requiere saber tu ubicaci贸n solo cuando est谩 activa</string>
</config-file>
<config-file parent="NSMotionUsageDescription" platform="ios" target="*-Info.plist">
<string>La app require saber los datos de movimiento del dispositivo</string>
</config-file>
<config-file parent="NSLocationAlwaysAndWhenInUseUsageDescription" platform="ios" target="*-Info.plist">
<string>La app requiere saber siempre tu ubicaci贸n solo cuando est谩 activa</string>
</config-file>
const backgroundGeolocationConfig: BackgroundGeolocationConfig = {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 10,
debug: false, // enable this hear sounds for background-geolocation life-cycle.
stopOnTerminate: false, // enable this to clear background location settings when the app terminates
notificationTitle: 'Background tracking',
notificationText: 'enabled',
url: '/location',
httpHeaders: {
'token': null
},
// Android only section
locationProvider: 1,
startForeground: true,
interval: 10000,
fastestInterval: 20000,
activitiesInterval: 10000,
startOnBoot: true, // Start background service on device boot
// iOS only section
pauseLocationUpdates: false, // Pauses location updates when app is paused,
saveBatteryOnBackground: false
}
backgroundGeolocation
.configure(backgroundGeolocationConfig)
.then(() => backgroundGeolocation.start())
Any help is really appreciated! <3
Nervermind, the url was wrong, it would be much better to avoid crashing the app if that HTTP request fail :)
Most helpful comment
As already mentioned above, setting the information via config.xml worked.
If somebody is facing the same issue, the first approach should be debugging the app with XCode directly.
But i set the config things like shown below
<config-file parent="NSBluetoothAlwaysUsageDescription" platform="ios" target="*-Info.plist"> <string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string> </config-file> <config-file parent="NSLocationAlwaysUsageDescription" platform="ios" target="*-Info.plist"> <string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string> </config-file> <config-file parent="NSLocationWhenInUseUsageDescription" platform="ios" target="*-Info.plist"> <string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string> </config-file> <config-file parent="NSMotionUsageDescription" platform="ios" target="*-Info.plist"> <string>Yeet your information to ios, even if its not shown ANYWHERE f*kin apple</string> </config-file>