CoreMotion updates in background state

前端 未结 5 1904
迷失自我
迷失自我 2020-12-02 06:57

With the M7 chip in the latest iOS devices one can get programmatically notified as the user goes from stationary to running, walking, etc using CMMotionActivityManager. Sta

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 07:25

    If your location manager is working in Active mode, to enable background mode you need to do this three steps:

    1. Check that [Target / Capabilities / Background Modes / Location updates] is enabled.
    2. [locationManager requestAlwaysAuthorization];
    3. locationManager.allowsBackgroundLocationUpdates = YES;

提交回复
热议问题