title: CMPedometer in iOS 10
body: <p>I'm trying to access <code>CMPedometer</code> data in iOS 10 and I've followed a few tutorials and I just can't seem to get anything to work. I've never tried to access this information before so don't really know where to start. I'd love some help on getting something setup. Any help you can provide will be greatly appreciated.</p>
  
  <p>I want to do both live updates and also access information form the passed but only within the same day.</p>
  
  <p>This currently doesn't open and prints a massive error.</p>
  
  <pre><code>import UIKit
  import CoreMotion
  
  class ViewController: UIViewController {
  
  var days:[String] = []
  var stepsTaken:[Int] = []
  
  let activityManager = CMMotionActivityManager()
  let pedoMeter = CMPedometer()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      let cal = Calendar.current
      var comps = cal.components([.year, .month, .day, .hour, .minute, .second], from: Date())
      comps.hour = 0
      comps.minute = 0
      comps.second = 0
      let timeZone = TimeZone.system
      cal.timeZone = timeZone
  
      let midnightOfToday = cal.date(from: comps)!
  
      if(CMPedometer.isStepCountingAvailable()){
  
          self.pedoMeter.startUpdates(from: midnightOfToday) { (data: CMPedometerData?, error) -&gt; Void in
              DispatchQueue.main.async(execute: { () -&gt; Void in
                  if(error == nil){
                      print("\(data!.numberOfSteps)")
                      //self.step.text = "\(data!.numberOfSteps)"
                  }
                })
             }
         }
  
      }
  }
  </code></pre>
  
  <p>I've been playing around with some things and realised that if the simulator is open as well a big error message appears. However if its closed and running only on my phone the error is: </p>
  
  <p>2016-07-16 18:13:38.054710 test[419:37870] [access] private</p>