我想在獲取用戶位置之前獲得用戶授權。我使用此代碼爲:獲取用戶位置警報不停留在屏幕上的iOS 8
self.locationManager = [[CLLocationManager alloc] init];
[self.locationManager setDelegate:self];
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
// iOS8+
// Sending a message to avoid compile time error
[self.locationManager requestAlwaysAuthorization];
}
[self showIndicatorView];
self.getCityService = [[GetCitiesService alloc] initServiceWithDelegate:self isLocalCall:NO];
[self.getCityService fetchCities];
我看到屏幕上的警報,但之前,我允許它與否,它消失形式的屏幕和應用程序沒有被授權。
我想我的代碼停止,直到用戶給予權限。
我做任何輸入 – iBug 2014-11-24 11:18:34
那麼你所呼叫的方法兩次可能會導致意外的行爲之前,在此之前,但警報GET消失。 – rckoenes 2014-11-24 11:19:45
我使用你的代碼,但仍然是同樣的問題。 – iBug 2014-11-24 11:27:31