Contents

Develop
2015.04.27 18:40

[ios] GPS 이용 상태 확인

조회 수 2945 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
433 Develop [c] 단기과정[01/08] 배열, 포인터 hooni 2003.04.23 8358
432 Develop [c] 단기과정[01/17] 후위연산 스택 계산기.. file hooni 2003.04.23 8352
431 Develop [js] 여러가지 트리(tree) 모음.. ㅋㅋ file hooni 2013.04.23 8350
430 Develop [c] 윈도우 API Viewport와 Window file hooni 2013.04.23 8349
429 Develop [c++] mfc 기반 멀티수납(wall)시스템 소스와 실행파일 file hooni 2013.04.23 8348
428 Develop [c/c++] Makefile 사용하기.. ㅋㅋ hooni 2003.04.23 8347
427 Develop [c] C에서 MySQL DB 사용하기~ file hooni 2003.04.23 8346
426 Develop [ios] Did UIScrollView End Scrolling? hooni 2016.04.19 8344
425 Develop [js] 후리자(영규) 스타일들.. file hooni 2013.04.23 8343
424 Develop [c] 달팽이 배열? 인지 먼지.. ㅋㅋ hooni 2013.04.23 8339
423 Develop [js] 빈도우즈(bindows96) file hooni 2013.04.23 8337
422 Develop [c] 확인해 볼거.. ㅡ,.ㅡ; file hooni 2013.04.23 8323
Board Pagination Prev 1 ... 58 59 60 61 62 63 64 65 66 67 ... 99 Next
/ 99