3

I have an app that just counting steps in Active State and Background Mode with CoreMotion CMPedometer.

It works fine on ios 12.4.1

ios 13: steps counting doesn't work in Background Mode, but work in Active State.

I haven't any errors and in Active State I get "steps, that I went in background".

I have permission NSLocationWhenInUseUsageDescription

In fact, I do not receive a notification (print in console) that I am moving.

Please help.

4

1 回答 1

1

我对此进行了一些研究,结果发现后台处理逻辑已在 iOS 13 上更新。我看到当应用程序进入后台时,我的步数跟踪 (CMPedometer) 任务几乎立即被终止。

您最有可能application(_:performFetchWithCompletionHandler:)用于在后台跟踪用户步骤和动作。这在 iOS 13 SDK 上现已弃用,您将需要使用它BGAppRefreshTask来实现相同的功能。

更多详细信息在此处的 Apple 文档中。

于 2020-01-09T09:08:52.247 回答