Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This could be related to the fact that in iOS7 enabling Location Services whilst in the background does not give you unlimited background processing time as it did in previous iOS version. Check out the WWDC 2013 What’s New in Core Location video at around 5 minutes 30. Therefore your app gets suspended again around 30 seconds after receiving the push notification.</p> <p>I have a similar problem which as yet I've not found the solution to. However if you'd like to get to the same place I am try the following -</p> <p>Firstly put an NSLog in didReceiveRemoteNotification, run your app on the device, put it into the background and send it a push notification. If you see your NSLog you'll know that the content-available flag is set correctly in your push.</p> <p>Next add an NSLog in -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations. If this gets hint then you know that you are indeed enabling location services.</p> <p>If you get this far you've probably got the same problem I have. 30 seconds isn't always long enough to get a location to the accuracy I want it.</p> <p>BTW if you're using an iPhone 5 or newer you can use deferred location and keep location services running constantly. Sadly I need it to work on an iPhone 4s.</p> <p>UPDATE - I've now found that this is specifically related to background push notifications and didReceiveRemoteNotification. Enabling Location Manager from a standard background task will work as it did before iOS7. Therefore you can still use background tasks together with Location Manager to get your position every x minutes, you just can't start the whole thing off using a background push.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload