1. Join in the project? Corelocation.framework
2. Enter for example the following in the. h file:
1. #import <corelocation/cllocation.h>2. #import <corelocation/cllocationmanager.h>3. #import < Corelocation/clgeocoder.h>4. #import <coreLocation/CLPlacemark.h>
3. In the. m file input such as the following:
1.//BeiJing2. #define Bj_latitude 40.063813. #define Bj_longitude 116.1346574. #define Sh_latitude 31.2194235. #define SH _longitude 121.4965586.7....8. Cllocation *loc = [[Cllocation alloc]initwithlatitude:bj_latitude longitude:bj_longitude];9.10. Clgeocoder *geocoder = [[Clgeocoder alloc] init];11. [Geocoder reversegeocodelocation:loc completionhandler:^ (Nsarray *array, Nserror *error) {12.13. if (Array.count > 0) {14.15. Clplacemark *placemark = [array objectatindex:0];16.17. NSString *city = placemark.administrativearea;18. NSLog (@ "located in:%@", city); NSLog (@ "%@", placemark); . }];
4. Results:
1.2014-03-19 19:52:01.320 location[1366:70b] is located in: Beijing 2.location[1366:70b "Su Jia Tuo Zhen, Haidian District, Peking City, China" Su jia Tuo zhen @ <+0.00000000, Haidian District, Peking City, China +0.00000000> +/-100.00m, Region clcircularregion (identifier: ' <+40.02953100,+116.20858200> radius 9051.17 ', Center:<+40.02953100,+116.20858200>, radius:9051.17m)