Develop
2015.04.27 18:40

[ios] GPS 이용 상태 확인

Views 1293 Votes 0 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

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
No. Category Subject Author Date Views
713 Develop [ios] 설정에서 푸시 알림(APNS) on/off 상태 확인 hooni 2015.04.28 2044
» Develop [ios] GPS 이용 상태 확인 hooni 2015.04.27 1293
711 Develop [js] jQuery, Javascript 모바일(스마트폰) 판단하는 방법 hooni 2015.04.26 2449
710 Develop [js] e.stopPropagation() VS e.preventDefault () file hooni 2015.04.14 808
709 Develop [js] 모바일 스크롤 방지(해제) hooni 2015.04.14 1588
708 Develop [js] 스크롤 이벤트 막기 hooni 2015.04.14 1007
707 Develop [ios] 앱에서 설정화면 호출하기 hooni 2015.04.07 743
706 Develop [ios] GMT Date와 Local Date 변환하기 hooni 2015.04.07 825
705 Develop [ios] 아이폰 앱 이름 및 버전 정보 hooni 2015.03.24 844
704 Develop [ios] 카메라 사용 권한 확인해서 분기하는 방법 hooni 2015.02.26 1867
703 Develop [ios] Touch ID 적용 샘플 코드 (예제) file hooni 2015.02.23 663
702 Develop [펌] 게임 엔진 만든거 공개합니다. hooni 2015.02.21 2350
701 Develop [ios] StoryBoard(xib) 없이 프로젝트 만들기 file hooni 2015.02.12 1063
700 Develop [ios] UIWebView에서 로컬에 있는 html 파일 불러오기 hooni 2015.02.10 889
699 Develop [ios] 로컬에 있는 JS 파일 웹뷰에서 동적으로 실행하기 hooni 2015.02.10 947
698 Develop [ios] 로컬에 있는 html 실행하기 hooni 2015.02.10 1026
Board Pagination Prev 1 ... 7 8 9 10 11 ... 53 Next
/ 53