用户位置在地图中不可见

时间:2015-12-02 16:20:42

标签: ios objective-c core-location

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    [[self mapView] setShowsUserLocation:YES];

    self.locationManager = [[CLLocationManager alloc] init];

    [[self locationManager] setDelegate:self];


    if ([[self locationManager] respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [[self locationManager] requestWhenInUseAuthorization];
    }

    [[self locationManager] setDesiredAccuracy:kCLLocationAccuracyBest];
    [[self locationManager] startUpdatingLocation];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

用户位置在地图中不可见 iOS 9.1 Xcode 7.1.1

0 个答案:

没有答案