if(CMMotionActivityManager. This will check if CNNotionActivityManager is isActivityAvailable()){ available on the system or not because before iOS 7 you can not use it. if activity manager is active it will use the iPhone sensor to if the user is moving or withHandler: { (data:CMMotionActivity?) -> Void in not. if ((data?.walking) == true || (data?.running) == true) { } else{ print("not walking"); This will if there are update every 1 = 1 second. This should count the number of steps and print("Number of steps = \(data.numberOfSteps)") let steps : NSNumber = save it. data.numberOfSteps let strConvert = String(steps) let errorAlert = UIAlertView(title: "You If the user is moving the phone should show are Running or walking now", message:strConvert, delegate: self, him that it is tracking his movement by cancelButtonTitle: "OK") errorAlert.show() showing him this message. let secondController = SecondViewController() secondController.activateExcercise()
if(CMMotionActivityManager. isActivityAvailable()){ This will check if CNNotionActivityManager is available on the system or not because before iOS 7 you can not use it. withHandler: { (data:CMMotionActivity?) -> Void in if ((data?.walking) == true || (data?.running) == true) { } else{ print("not walking"); if activity manager is active it will use the iPhone sensor to if the user is moving or not. = 1 This will if there are update every 1 second. print("Number of steps = \(data.numberOfSteps)") let steps : NSNumber = data.numberOfSteps let strConvert = String(steps) This should count the number of steps and save it. let errorAlert = UIAlertView(title: "You are Running or walking now", message:strConvert, delegate: self, cancelButtonTitle: "OK") errorAlert.show() let secondController = SecondViewController() secondController.activateExcercise() If the user is moving the phone should show him that it is tracking his movement by showing him this message.
ThesisV5.docx