這是一個奇怪的行爲,在iOS應用程序。 這是關係到我的問題代碼:位置服務:地點總是和位置當使用
初始化位置的東西:
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager requestWhenInUseAuthorization];
當請求定位功能:
if ([CLLocationManager authorizationStatus]!=kCLAuthorizationStatusAuthorized) {
// Give a message to the user: NO GPS HERE!
}
而且app.plist裏面我把鑰匙:NSLocationWhenInUseUsageDescription
,帶一個字符串。
由於某些原因,我不明白,它不起作用。我被告知GPS不允許這個應用程序,我必須改變隱私設置,我會根據要求更改隱私設置,我會回來再試一次,並獲得相同的信息...。並陷入無限循環。
另一方面,如果我把一個關鍵字:NSLocationAlwaysUsageDescription
,與一個字符串在app.plist內;不改變代碼中的任何內容。 然後我的應用程序被允許使用位置功能(LocationAlways)。 儘管它比沒有GPS好,但我的應用最終會使用-LocationAlways模式,因爲它很樂意使用-LocationWhenInUse模式。
任何人都有同樣的問題,並找到了解決辦法?
有道理,.....和它的工作。 謝謝! – Michel