Trying to find a way to detect M7 being present.
Is it pointless to query CMStepCounter or CMMotionActivity class if M7 is not present? My guess is that on non M7 models having iOS 7.0, these classes get data but not that efficiently & use a lot more battery.
A crude way would be:
struct utsname systemInfo;
uname(&systemInfo);
model = [[NSString alloc] initWithCString:systemInfo.machine
encoding:NSUTF8StringEncoding];
version = [[NSString alloc] initWithString:[[UIDevice currentDevice] systemVersion]];
if ([model compare:@"iPhone6,1"]) {
}
Use the APIs that Apple provides:
if ([CMStepCounter isStepCountingAvailable]) {
// The device supports step counting
} else {
// The device does not support step counting
}
if ([CMMotionActivityManager isActivityAvailable]) {
// You can use CMMotionActivity
} else {
// Nope, not supported
}
Of course this API is only on iOS 7 or later. So if you need to support iOS 5 or 6 then you need to wrap this code in a check for the CMStepCounter
class too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With