小编use*_*256的帖子

MKReverseGeocoder"在iOS 5中弃用"

它说它"在iOS 5中被弃用".

- (void)viewDidLoad {
    [super viewDidLoad];
    CLGeocoder *geocoder = [[CLGeocoder alloc] init];

    [geocoder reverseGeocodeLocation:self.locationManager.location // You can pass aLocation here instead
                   completionHandler:^(NSArray *placemarks, NSError *error) {

                 dispatch_async(dispatch_get_main_queue() , ^ {
                           // do stuff with placemarks on the main thread

                           CLPlacemark *place = [placemarks objectAtIndex:0];

                           NSString *zipString = [place.addressDictionary valueForKey:@"ZIP"];

                           [self performSelectorInBackground:@selector(showWeatherFor:) withObject:zipString];



                       }
            }
 }
Run Code Online (Sandbox Code Playgroud)

iphone xcode mkreversegeocoder ios

0
推荐指数
1
解决办法
6299
查看次数

标签 统计

ios ×1

iphone ×1

mkreversegeocoder ×1

xcode ×1