Contents

Develop
2015.04.27 18:40

[ios] GPS 이용 상태 확인

조회 수 1300 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

iOS 설정에서 GPS 설정 확인

[CLLocationManager locationServicesEnabled] == YES

앱에서 GPS 설정 확인

[CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied

이렇게 하면 편리함 ㅋㄷ

/*
//결정 전
kCLAuthorizationStatusNotDetermined = 0,
//제한 사용
kCLAuthorizationStatusRestricted,
//이용 거부
kCLAuthorizationStatusDenied,
//항상 이용 (백그라운드에서도; ex.지오펜스)
kCLAuthorizationStatusAuthorizedAlways NS_ENUM_AVAILABLE(NA, 8_0),
//앱이 사용중일때만 (포그라운드일때만)
kCLAuthorizationStatusAuthorizedWhenInUse NS_ENUM_AVAILABLE(NA, 8_0),
*/

// 사용 예
if([CLLocationManager locationServicesEnabled] == YES &&
  [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied) 
{
    // show the map
} else {
    // show error
}


[원문]

// User has not yet made a choice with regards to this application

kCLAuthorizationStatusNotDetermined = 0,


// This application is not authorized to use location services.  Due

// to active restrictions on location services, the user cannot change

// this status, and may not have personally denied authorization

kCLAuthorizationStatusRestricted,


// User has explicitly denied authorization for this application, or

// location services are disabled in Settings.

kCLAuthorizationStatusDenied,


// User has granted authorization to use their location at any time,

// including monitoring for regions, visits, or significant location changes.

kCLAuthorizationStatusAuthorizedAlways NS_ENUM_AVAILABLE(NA, 8_0),


// User has granted authorization to use their location only when your app

// is visible to them (it will be made visible to them if you continue to

// receive location updates while in the background).  Authorization to use

// launch APIs has not been granted.

kCLAuthorizationStatusAuthorizedWhenInUse NS_ENUM_AVAILABLE(NA, 8_0),



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
313 Develop [ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens) file hooni 2013.04.23 18788
312 Develop [ios] Objective-C 특정 문자 찾아 제거하기 hooni 2013.04.23 28070
311 Develop [ios] Objective-C 문자열 잘라서 배열(NSArray)에 넣기 hooni 2013.04.23 29420
310 Develop [Xcode] 디버깅 옵션 file hooni 2013.04.23 57201
309 Develop 웹페이지 성능 테스트 툴 설명 hooni 2013.04.23 27450
308 Develop [ios] 개발 기초 가이드 링크.. hooni 2013.04.23 31371
307 Develop 논문 실험용 고려대 툴바 ㅎㅎ secret hooni 2013.04.23 8686
306 Develop [ios] NSMutableString 문자열 패턴 교환 hooni 2013.04.23 28994
305 Develop [iphone] view에 대한 조사 ㅡ,.ㅡ; file hooni 2013.04.23 54074
304 Develop [ios] 구분자로 문자열 자르기 (split) hooni 2013.04.23 26274
303 Develop [ios] 아이폰 개발 총정리.. file hooni 2013.04.23 23868
302 Develop [ios] Debug Extensions (from 종길 차장님 ㅋㅋ) file hooni 2013.04.23 17696
Board Pagination Prev 1 ... 40 41 42 43 44 45 46 47 48 49 ... 71 Next
/ 71