Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)

One of our apps was recently rejected by apple because they said that our app does not require background location mode. We use the significant change api and region monitoring to be able to do different things based on the client we are working with. This could be loction based push notifications or displaying different content when a user come in proximity of a beacon or geofence region.


We believe that we need the background location permission so that the user will not have to walk around with the app open the entire time for them to get things like a notification, but that is besides the point. Right now we are trying to get the app approved while removing the background mode location flag from the app.


The problem when I do this, is that I get an exception:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)'


Even if I change the info.plist to use the NSLocationWhenInUseUsageDescription and [locationManager requestWhenInUseAuthorization], we are still getting this exception thrown. Does anyone have any advice on this? When adding the background location flag, everything works fine even when just asking for while in use authorization.


Thanks,

Chris

Replies

It is not possible to say why you are getting the exception without knowing what you are doing in your project, but...


With Significant Location Change and Region Monitoring services background operations are automatic. You do not need the 'location' UIBackgroundMode.

Neither you do need to set the allowsBackgroundLocationUpdates property.


The only thing you need is the requestAlwaysAuthorization. Without that, you will not get any updates in the background. So you need to put that back.