2013-11-10 67 views
3

我正在使用phonegap構建iOS應用程序。我試圖讓iOS在應用程序在後臺運行時將其當前位置更新到我的應用程序。我註冊了位置更新背景模式,但它不可靠。經過一番調查,我相信iOS會自動暫停位置更新。 CLLocationManager中有一個名爲'pausesLocationUpdatesAutomatically'的屬性,我認爲它是造成這種行爲的原因。位置更新自動暫停iOS

下面的聲明是在CLLocationManager.h CoreLocation.framework

/* 
* 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); 

有關如何禁用此功能的任何見解?

非常感謝。

+0

你找到一個解決的辦法?如果你有,可以發佈嗎? –

+0

不幸的是我沒有 – Shu

回答

1

您應該將此屬性設置爲NO這樣的:

_locationManager.pausesLocationUpdatesAutomatically = NO;