startMonitoringSignificantLocationChanges not fired?
I'm testing an app that uses startMonitoringSignificantLocationChanges on a 3GS with IOS 4.01 (I want my app to work in any version of IOS4 so I haven't upgraded the OS on this device).
info.pllist has a "registered for location updates" background key (not needed for startMonitoringSignificantLocationChanges but needed elsewhere in the app).
I found out that if the device is in sleep mode and my app is in the background, significant location updates are not triggered even if I travel for a long distance (passing through quite a few cell towers) and a long time. But as soon as I press the Home key to wake up the device (with my app still in the background, nothing in the foreground) - the location event handler in my app gets triggered with a valid location for that area (I can verify that this is a significant location event by checking the accuracy which is well over 100开发者_JAVA百科0 meters).
This defies the whole idea of monitoring significant location changes, because users do not travel with their devices in active state.
Unfortunately I don't have a device with a more advanced OS to check this (all my other devices are not iPhones and they do not support startMonitoringSignificantLocationChanges).
Is this a know issue or am I doing something wrong?
You need to make sure your AppDelegate is set up as the CLLocationManagerDelegate and have the correct methods set to receive the callbacks when the significant change is fired. If you have a different class set up as the delegate and your app goes to the background... chances are that class won't get woke up to receive them.
Try setting your AppDelegate to receive them... then call out to your class for any work you need done.
Have you looked through this question and its answers on a similar topic?
It's hard to tell without seeing your code, but maybe there's something missing in your implementation of the background behavior?
精彩评论