2

Recently I face a problem which is rare to appear What I try to do is to get the number of steps per minute.

In my code:

let date = NSDate()
    for i in 0...1000 {
        dispatch_async(mySerialQueue) {
            self.pedoMeter.queryPedometerDataFromDate(date.dateByAddingTimeInterval( Double(i+1) * -60.0 ), toDate: date.dateByAddingTimeInterval( Double(i) * -60.0 ), withHandler: { (data, error) in
                if let data = data {
                    print("\(data.numberOfSteps)")
                }
            })
        }
    }

Sometimes, the number of steps would return a big number which can be >1000000. After tracing the device log, I found that there is a error log:

Sep 15 16:42:59 locationd[6315] <Error>: Steps were found to be non monotonically increasing - start:488825.000000, end:488825.000000

and that is the weird step number.

I am trying to avoid the problem. That's why I am using a serial queue to do the query. However, I failed. Is there any way to avoid it?

2
  • Hey Horst, did you find any solution to the problem? Commented Mar 13, 2020 at 9:27
  • Sorry, I didn't. I've just ignore that noice Commented Apr 7, 2020 at 16:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.