简体   繁体   English

如何在CLLocationManager中更新位置

[英]How to update location in CLLocationManager

我正在开发地图应用程序,当我运行该应用程序时,它会显示我的当前位置并获得正确的纬度和经度,必须通过邮件将信息发送给某人,我已经实现了所有事情,直到邮件发送正常,我只需要有关更新CLLocationManager函数的帮助,发送邮件后,我尝试调用函数[locationmanager startupdatinglocation],但是它第二次被调用,即使我第二次将NSTimer询问位置。

Try like this place, 尝试在这个地方,

 locationManager = [[CLLocationManager alloc] init];
 locationManager.delegate = self;
 [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(UpdateLocation) userInfo:nil repeats:YES];

In viewdidload and call this method from timer, 在viewdidload中,并从计时器调用此方法,

-(void)UpdateLocation
{
   [locationManager startUpdatingLocation];
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM