ios - 后台CLLocationManager在15分钟后停止更新

标签 ios iphone mkmapview cllocationmanager

我已使用NSLocationAlwaysUsageDescription设置了info.plist,该应用程序在后台运行。大约15分钟后,它停止了。在“应用程序功能”部分启用了后台模式和位置​​服务

其他一切似乎都工作正常。

- (void)applicationDidEnterBackground:(UIApplication *)application {
NSLog(@"Entered Background");
self.appdelegatelocationManager = [[CLLocationManager alloc]init];
self.appdelegatelocationManager.delegate = self;
[self.appdelegatelocationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[self.appdelegatelocationManager setDistanceFilter:kCLDistanceFilterNone];
[self.appdelegatelocationManager setPausesLocationUpdatesAutomatically:NO];
[self.appdelegatelocationManager startUpdatingLocation];    

}

一旦我再次进入该应用程序并再次进入后台,它将再次工作15分钟。

请帮忙!

最佳答案

转到项目设置>后台模式下的目标,启用以下文件

1-位置更新
2-背景提取。 enter image description here

链接图像。

您的问题将得到解决。

关于ios - 后台CLLocationManager在15分钟后停止更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35283951/

相关文章:

ios - 在 Xamarin iOS 中定义文本字体大小的模式

ios - 避免 UIImage 的 imageNamed - 内存管理

ios - 表格单元格中的 UIButton "unrecognized selector sent to instance"

ios - 如何在 ios 的歌曲加载时间中显示或隐藏事件指示器

ios - mkmapview 在指定帧中显示路线和注释

ios - 用照片制作 map ,例如 Instagram Photo Map

iphone - 为什么这个不同的 "addSubView"代码会导致行为差异

iphone - 如何删除 UITabBarItem 下方的空间?

iphone - UITableViewCell 内的水平 UIScrollView

swift - 将数据从 MKAnnotationView 传递到 UICollectionViewController