iOS8 포지셔닝 서비스

어린이들이 iOS8 시스템을 업데이트한 후에 어떤 프로그램은 위치를 정할 수 없다는 것을 발견했다. 그것은 iOS8이 프라이버시를 최적화하기 때문에 몇 가지 설정을 추가해야 하기 때문이다. 구체적인 조작은 다음과 같다.
1. @interface에서:
    CLLocationManager *locationManager;
2. 초기화:
    locationManager = [[CLLocationManager alloc] init];
3. 호출 요청:
    [locationManager requestAlwaysAuthorization];
    [locationManager startUpdatingLocation];
4. info.plist에 가입:
NSLocationWhenInUseUsageDescription, 프론트 데스크에서 GPS에 대한 설명을 얻을 수 있습니다.
NSLocation AlwaysUsageDescription, 백그라운드에서 GPS에 대한 설명을 얻을 수 있습니다.
//        
locationManager = [[CLLocationManager alloc] init];    
locationManager.delegate = self;   
locationManager.desiredAccuracy = kCLLocationAccuracyBest;    
locationManager.distanceFilter = kCLDistanceFilterNone;    
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])    
{        
[locationManager requestWhenInUseAuthorization];    
}    
[locationManager startUpdatingLocation];

좋은 웹페이지 즐겨찾기