对于iPhone应用程序,我需要在启动时确定用户所在的国家/地区.据推测,我将不得不打开位置服务并进行某种反向地理编码.如果可能的话,我真的不想使用第三方网络服务,是否有任何其他建议来确定服务提供的位置?
最初,我只需要检查用户是否在美国境内,但是将来可能会更改以添加更多国家/地区.我知道无法始终确定位置或用户可能已关闭位置服务.基本上,我只需要知道用户是否被检测到是在美国境内,以便关闭特定功能.
编辑:进一步阅读,它看起来像MKReverseGeocoder,除了我不希望在我的应用程序中显示任何地图,这意味着我不允许使用它.
目前我在iPhone应用程序中工作,使用CLLocationManager获取纬度和经度值.我不知道这个?如何从此纬度和经度值获取设备位置(地址)名称?请帮我
提前致谢
我试过这个:
- (void)viewDidLoad
{
[super viewDidLoad];
LocationManager = [[CLLocationManager alloc]init];
LocationManager.delegate=self;
LocationManager.desiredAccuracy = kCLLocationAccuracyBest;
[LocationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSString * latitude = [[[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.latitude]autorelease];
NSString * longitude = [[[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.longitude]autorelease];
[LocationManager stopUpdatingLocation];
NSLog(@"latitude:%@",latitude);
NSLog(@"longitude:%@",longitude);
}
Run Code Online (Sandbox Code Playgroud)