简体   繁体   中英

How to get current location without using delegate?

For some reasons, I hope to get the current location without using the delegate method.
Is there some solutions which can get the current location just from CLLocationManager?

您还可以使用CLLocationManager类的定位方法,该方法将返回设备的最后已知位置。

manager = [[CLLocationManager alloc] init]; [manager startUpdatingLocation]; CLLocation *location = [manager location];

Check below links , those are the good Implementation of location update with Block :

https://github.com/ideaismobile/AKLocationManager

https://github.com/axldyb/CLLocationManager-blocks

https://github.com/keithpitt/DKLocationManager

Even you can use NSNotificationCenter for it ,

Check this : https://stackoverflow.com/a/16173504/2919739

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM