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?
Asked
Active
Viewed 1,255 times
0

Pratik Bhiyani
- 2,489
- 3
- 17
- 27

zproject89
- 225
- 5
- 19
-
3What's the problem with delegate ? – Pratik Bhiyani Apr 12 '14 at 03:43
-
Do you have a mapView in your controller? – Zhans Apr 12 '14 at 04:15
-
No, I just need get the user's current location, and then upload it to the server. – zproject89 Apr 12 '14 at 04:17
2 Answers
5
You can also use location method of CLLocationManager class which will return last known location of device.
manager = [[CLLocationManager alloc] init];
[manager startUpdatingLocation];
CLLocation *location = [manager location];
4
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

Community
- 1
- 1

Pratik Bhiyani
- 2,489
- 3
- 17
- 27
-
Thank you so much. I think I need some time to have a look carefully. – zproject89 Apr 12 '14 at 04:45
-
Welcome bro and ya don't forget to accept my answer If you find it useful :) – Pratik Bhiyani Apr 12 '14 at 04:47