Which iOS devices support CMStepCounter?

2019-07-11 19:54发布

问题:

Apple added step count support with the M7 in the new iPhone 5s. This is the documentation on isStepCountingAvailable

isStepCountingAvailable Returns a Boolean indicating whether step-counting support is available on the current device.

  • (BOOL)isStepCountingAvailable Return Value YES if step-counting support is available or NO if it is not.

Discussion Step-counting support is not available on all iOS devices. Use this method to determine if support is available on the current device.

Availability Available in iOS 7.0 and later. Declared In CMStepCounter#

When I run:

BOOL isUsersHardwareCompatibleWithPedometerApp = [CMStepCounter isStepCountingAvailable];

on my 5s isUsersHardwareCompatibleWithPedometerApp's value is YES.

Which devices will return YES for Core Motion's CMStepCounter class method + isStepCountingAvailable? Also can I restrict devices which return NO from downloading my app in the AppStore? Or is there a good proxy for restricting users from downloading my app such as the front facing camera being a good proxy for determining if the user has at least 512mb of ram?

回答1:

I don't have a device to test with but @_DavidSmith, creator of the popular Pedometer++ app has determined that the new iPad Air/rMini don't give step data.

After some investigation the iPad Air/rMini look to support activity categorization but not step counting w/ its M7. Which makes sense to me

https://twitter.com/_DavidSmith/status/404252937821900801

Thus so far the iPhone 5s is the only device that supports step data.



回答2:

Currently (Nov 2013), only the iPhone 5S, the iPad Air and iPad mini with retina display have the M7 coprocessor, which is required for step counting. As per this answer, there is no way currently to restrict devices based on M7 availability.