开发者

CLLocationManager startUpdatingLocation vs startMonitoringSignificantLocationChanges

I am working on a web application that enables users to login to the app, only if they're in certain specified regions. I called locationManager startUpdatingLocation at the beginning of my app to get the user's location and enables/disables logging in.

Once the user is logged on, I called

[locationManager stopUpdatingLocation];
[locationManager startMonitoringSignificantLocationChanges];

and logs the user out when the updated location is outside of the region. Would using the two methods clash in any w开发者_如何学编程ay? (I'm testing the code on the simulator therefore the location is always the same).

Note: I'm not using didEnterRegion or didExitRegion because everything is handled by an existing Javascript code. I'm only sending in the user's current location.


It really depends on what you need with the location after the user logs in. When you monitor for significant changes, your locationManager will only be notified on major changes. (e.g. New cell tower, change in wifi, other app calls location, etc). It won't be on a consistent basis. If all you care about is the user logging in, I would possibly do away with the significant monitoring all together. If you still need location, then be prepared to only get sporadic updates on the location.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜