iPhone Development - Making sure we have a fresh location
How does this condition work? I'm unable to comprehend this.
if ([newLocation.timestamp timeIntervalSince1970] < [NSDate timeIntervalSinceReferenceDate] - 60) return;
Reference: More iPhone 3 Dev开发者_如何学编程elopment - Tackling iPhone SDK 3
I'll go with what Jason suggested. I wrote a blog post for this on the book's forum but i never heard back!
"This condition doesn't work reliably, assuming that newLocation is an instance of CLLocation. It's using two different bases, but I would assume the check is meant to test whether some location information is less than 60 seconds old. Both should be either timeIntervalSince1970 or timeIntervalSinceReferenceDate (i.e., have the same basis). (Also we assume he meant [[NSDate date] dateWithTimeIntervalSinceReferenceDate] since the other would throw an exception)." – Jason Coco
精彩评论