motion


motion은 3.0.0 버전 이상 부터 제공되며 해당 라이브러리를 추가하여 사용해야 된다.

motion 는 디바이스의 Gyro 정보를 제공하는 기능이다.
확장 프레임워크 파일을 추가하여 사용할 수 있으며 추가 방법은 iOS 개발 가이드 의 내용을 참조한다.


getCurrent

현재 모션 정보를 얻어오는 기능이며 호출 방법은 다음과 같다.

Example

DAPMotion.getCurrent({ resultDict in
   // TODO
}, failure: { error in
   // TODO
})
[DAPMotion getCurrent:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

watch

모션 모니터링 기능이며 호출 방법은 다음과 같다.

options

필드필드비고M/O
watchIdwatch 아이디문자열M
delay모니터링 interval초단위M
     

Example

let watchId = "id"
let delay = NSNumber(value: 1)
DAPMotion.watch(watchId, delay: delay, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSString *watchId = @"id";
NSNumber *delay = @1;
[DAPMotion watch:watchId delay:delay completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

clearWatch

모션 모니터링 삭제 기능이며 호출 방법은 다음과 같다.

options

필드필드비고M/O
watchIdwatch 아이디문자열M
     

Example

let watchId = "id"
DAPMotion.clearWatch(watchId, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSString *watchId = @"id";
[DAPMotion clearWatch:watchId completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

Error Code

CodeCauseComment
E12300파라메터 값이 잘못되어 있을 경우 
E12301전달된 액션 값이 알 수 없는 액션일 경우 
E12302watch 아이디 값이 없거나 nil 인 경우 
E12303화면 갱신 시간 정보가 0 ~ 3 정수값이 아닌 경우 
E12350실행 중 오류가 발생 되었을 경우 
E12351watch 요청 시 watch 아이디 값이 존재하는 경우 
E12352clearWatch 요청 시 watch 아이디 값을 찾을 수 없는 경우 
E12353Motion 정보를 얻기위한 서비스가 지원하지 않는 경우 
E12399알 수없는 오류가 발생 되었을 경우