Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
565 views
in Technique[技术] by (71.8m points)

iphone - Locationservice Indicator stays "on"

I have a created a small app which uses location services on the iPhone. All works well, except the fact, that sometimes, the small arrow in the info-bar stays active even if I explicitly kill the app. I use the background mode for locationservices, thus the appDelegate methods applicationWillResignActive, applicationDidEnterBackground, applicationWillEnterForeground and applicationDidBecomeActive are implemented but do not touch the location services (well - I need them in background mode).

In that configuration applicationWillTerminate is never called; I implemented all the cleanup cleanup as stopUpdatingLocation in dealloc, as I did not find any other place appropriate for this. But still - the indicator stays on.

Any ideas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem - app leaving the location indicator on in the status bar.

My problem turned out to be that I had originally called the 'startMonitoringSignificantLocationChanges' method of CCLocationManager thinking that would give rough location info that I could up the resolution on when I really needed it.

Unfortunately once an app has called that method once, even if you then delete the app and re-install it it will always re-show the icon in the status bar until the app calls 'stopMonitoringSignificantLocationChanges' on CCLocationManager to unregister itself from the system - complete pain as I have to leave that code in until it has sorted itself out on the several people who were testing my app for me.

So if you get that icon stuck on with your app make sure you've matched any calls to 'startMonitoringSignificantLocationChanges' with a stop call.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...