iPhone

iOS CLLocationManager 바뀐점 8.0

zombie45 2014. 10. 22. 14:04

iOS CLLocationManager 바뀐점 8.0


.plist 파일에 다음 항목 추가

NSLocationWhenInUseUsageDescription

NSLocationAlwaysUsageDescription

string 값으로 위치 사용에 대한 안내문을 적어놓으면됨 (예: 사용자의 현재 위치를 받아옵니다)


사용자 현재 위치 허용에 대한 승인을 받는다

    if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])

        [locationManager requestWhenInUseAuthorization];

    if ([locationManager respondsToSelector:@selector(requestAlwaysAuthorization)])

        [locationManager requestAlwaysAuthorization];

반응형