【发布时间】:2013-06-19 09:00:31
【问题描述】:
两个问题:
我从 Singleton 调用了 LocationManager。当我运行以下代码时,它从启动的那一刻起无限循环。我怀疑这是处理器,尤其是电池密集型。一旦你有足够准确的修复,有什么批准的方法来终止这个循环?
我可以调整它以返回经度/纬度(经度/纬度)吗?
(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)旧位置 {
int 度数 = newLocation.coordinate.latitude;
双十进制 = fabs(newLocation.coordinate.latitude - degree);
int 分钟 = 十进制 * 60;
双秒 = 十进制 * 3600 - 分钟 * 60;
NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", 度、分、秒];
NSLog(@" 当前纬度 : %@",lat);
degrees = newLocation.coordinate.longitude;
decimal = fabs(newLocation.coordinate.longitude - degree);
分钟 = 小数 * 60;
秒 = 十进制 * 3600 - 分钟 * 60;
NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", 度、分、秒];
NSLog(@" 当前经度 : %@",longt);
}
【问题讨论】: