【发布时间】:2012-04-03 01:56:18
【问题描述】:
我不明白文档中的这个例子:timeIntervalSinceNow 方法应该显示一个正值,但我们如何才能达到代码中提到的“5”? (我认为它或多或少是 0,或 -10、-20、-30 等......但我们怎样才能得到一个正值,比如 5?):
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
// test the age of the location measurement to determine if the measurement is cached
// in most cases you will not want to rely on cached measurements
NSTimeInterval locationAge = -[newLocation.timestamp timeIntervalSinceNow];
if (locationAge > 5.0) return;
感谢您的帮助
【问题讨论】:
标签: objective-c cllocation nstimeinterval