Contents

Develop
2015.04.27 18:40

[ios] GPS 이용 상태 확인

조회 수 2934 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
315 Develop [php] php+db 연동(odbc, mssql, mysql, sybase) 3 hooni 2013.04.23 9693
314 Develop 프로그램 문서 관리 (Doxygen) hooni 2013.04.23 17834
313 Develop 프로그래밍 소스 관련 사이트.. hooni 2013.04.23 17900
312 Develop 도메인 관련 솔루션 분석할 거.. ㅋㄷ file hooni 2013.04.23 7975
311 Develop [js] 수명체크 프로그램 ㅋㅋ file hooni 2013.04.23 7815
310 Develop [c] 패킷 에널라이저 예제 소스(성안당) file hooni 2013.04.23 7875
309 Develop [js] 숫자만 입력하게 하는 자바스크립트 hooni 2013.04.23 7969
308 Develop [js] 셀렉트박스(select)의 옵션(option) 동적으로 추가/제거 file hooni 2013.04.23 9228
307 Develop [c] 학교 건물 최단거리 찾는 웹 연동 프로그램 file hooni 2013.04.23 8073
306 Develop [c] 암호화 알고리즘 DES 구현 ㅋㅋ file hooni 2013.04.23 8556
305 Develop [c] 내가 만든 암호화 프로그램.. 좋아^^ file hooni 2013.04.23 8491
304 Develop [c] 숫자(int, Number)를 hex코드로 변환하는 소스 file hooni 2013.04.23 9723
Board Pagination Prev 1 ... 40 41 42 43 44 45 46 47 48 49 ... 71 Next
/ 71