diff --git a/MotionDetection/MotionDetection-Prefix.pch b/MotionDetection/MotionDetection-Prefix.pch index 82a2bb4..858c64c 100644 --- a/MotionDetection/MotionDetection-Prefix.pch +++ b/MotionDetection/MotionDetection-Prefix.pch @@ -10,6 +10,9 @@ #warning "This project uses features only available in iOS SDK 5.0 and later." #endif +#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) + + #ifdef __OBJC__ #import #import diff --git a/MotionDetection/ViewController.m b/MotionDetection/ViewController.m index 98faa67..89d9cde 100644 --- a/MotionDetection/ViewController.m +++ b/MotionDetection/ViewController.m @@ -45,7 +45,10 @@ - (void)viewDidLoad // Do any additional setup after loading the view, typically from a nib. [SOMotionDetector sharedInstance].delegate = self; - [SOMotionDetector sharedInstance].useM7IfAvailable = YES; //Use M7 chip if available, otherwise use lib's algorithm + if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) + { + [SOMotionDetector sharedInstance].useM7IfAvailable = YES; //Use M7 chip if available, otherwise use lib's algorithm + } [[SOMotionDetector sharedInstance] startDetection]; }