我正在使用phonegap 构建一个iOS 应用程序。当应用程序在后台运行时,我试图让 iOS 将其当前位置更新到我的应用程序。我已经注册了位置更新后台模式,但它不可靠。经过一番研究,我认为 iOS 会自动暂停位置更新。 CLLocationManager 中有一个名为“pausesLocationUpdatesAutomatically”的属性,我认为它是造成这种行为的原因。
以下声明来自 CoreLocation.framework 中的 CLLocationManager.h
/*
* pausesLocationUpdatesAutomatically
*
* Discussion:
* Specifies that location updates may automatically be paused when possible.
* By default, this is YES for applications linked against iOS 6.0 or later.
*/
@property(assign, nonatomic) BOOL pausesLocationUpdatesAutomatically __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0);
有关如何禁用此功能的任何见解吗?
非常感激。
Shu
您应该将此属性设置为 NO,如下所示:
_locationManager.pausesLocationUpdatesAutomatically = NO;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)