문제

I'm developing a navigation app which can run in the background. That's working fine thanks to setting UIAccelerometer to location. But I'd like to use the accelerometer too, to get some additional information about what the user is doing. However, while in the background, the UIAccelerometer doesn't call its delegate.

Is there any way to get the current acceleration while being in the background?

도움이 되었습니까?

해결책

I found the solution myself. It is indeed possible to get accelerometer data while running in the background. All one has to do is to rely on the CoreMotion framework rather than on the UIAccelerometer class which, as the name suggests, is a user interface related class.

See this question: How Nike+ GPS on iPhone receives accelerometer updates in the background?

다른 팁

NO..you won't be able to get UIAccelerometer values in the background..you can get heading and other types of values specific to core location though..

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top