iOS CoreMotion, CoreLocation


CoreMotion 사용설정

Info.plist

NSMotionUsageDescription

UIRequiredDeviceCapabilities 에 accelerometer, gyroscope 등

import CoreMotion

let cmManager = CMMotionManager()

CoreLocation

Info.plist Always When use…

import CoreLocation

var locationManager = CLLocationManager()

delegate 잡아주고.

locationManager.requestAlwaysAuthorization()

locationManager.startUpdatingLocation()

백그라운드에서도 업데이트 받으려면…

Application target → Sign in & Capabilities → Capabilities button on the left → Choose Background Modes. Then, enable location updates.

locationManager?.allowsBackgroundLocationUpdates = true
,

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다