3

I was wondering if anyone can point me in the right direction with regard to utilzing the M7 chip in the iPhone5S and above.

I was wondering if it's just automagically used when you use general core motion APIs or is there a specific set of APIs to use?

Finally I noted whilst reading some articles online that it keeps some historical movement data, anyone know how to access this or can anyone point me in the right direction?

4

2 回答 2

6

您正在寻找的两个主要类是CMMotionActivityManagerCMMotionActivity。第一个可让您查询历史数据并总体管理运动。第二个使您可以访问不同的、更具体的运动类型。

这两个类仅在 iOS 7-[CMMotionActivityManager isActivityAvailable]上可用。用于首先确定运动是否可用。我没有找到任何关于它的文档,但我的猜测是该方法只会YES在具有 M7 芯片(或支持运动活动报告的未来芯片)的设备上返回。

于 2013-10-28T16:43:24.527 回答
1

如果您正在寻找历史数据,那么查看这个特定函数可能很有价值:queryStepCountStartingFrom:to:toQueue:withHandler:它是 CMStepCounter 的一部分,仅在配备 M7 的手机上可用。从文档:

This method runs asynchronously, returning immediately and delivering the 
results to the specified handler block. The system stores only the last
seven days worth of step data at most. If there are no samples for the 
specified range of time, a value of 0 is passed to the handler block.

希望这会有所帮助!

于 2014-05-07T06:08:35.193 回答