- (void)addXLsn0wLocation {
[[XLsn0wLocation defaultLocation] startLocationAddress:^(BOOL isSuccess, XLsn0wLocationModel *locationModel) {
if (isSuccess) {
NSDictionary *locationInfo = locationModel.locatedAddress;
NSLog(@"%@", [locationInfo objectForKey:@"Country"]);
NSLog(@"%@", [locationInfo objectForKey:@"State"]);
NSLog(@"%@", [locationInfo objectForKey:@"City"]);
NSLog(@"%@", [locationInfo objectForKey:@"SubLocality"]);
NSLog(@"%@", [locationInfo objectForKey:@"Street"]);
_location.text = [NSString stringWithFormat:@"%@ %@ %@", [locationInfo objectForKey:@"Country"], [locationInfo objectForKey:@"State"], [locationInfo objectForKey:@"City"]];
// NSLog(@"%@", [dic objectForKey:@"CountryCode"]);
// NSLog(@"%@", [dic objectForKey:@"FormattedAddressLines"]);
// NSLog(@"%@", [dic objectForKey:@"Name"]);
// NSLog(@"%@", [dic objectForKey:@"Thoroughfare"]);
}else {
NSLog(@"定位失败");
}
}];
}
我的Github->https://github.com/XLsn0w
我的新浪微博-> @XLsn0w
我的微信公众号-> Cydiapple