你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> 檢測ios的用戶是否拒絕開啟默認位置的實現

檢測ios的用戶是否拒絕開啟默認位置的實現

編輯:關於IOS

原問題描述:

請問一下,檢測ios的用戶是否拒絕開啟默認位置,能實現麼? 我需要在實現檢測結果,然後根據他們的選擇顯示不同的視圖控制器。 解決方案: 假設你使用LocationManager,那麼在delegate中有個方法是 [plain]   - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error     你來檢測這個error.code是什麼,具體參見apple官方文檔Core Location Constants Reference中CLError部分 [plain]   enum {   kCLErrorLocationUnknown  = 0,         // location is currently unknown, but CL will keep trying   kCLErrorDenied,                       // CL access has been denied (eg, user declined location use)   kCLErrorNetwork,                      // general, network-related error   kCLErrorHeadingFailure,               // heading could not be determined   kCLErrorRegionMonitoringDenied,       // Location region monitoring has been denied by the user   kCLErrorRegionMonitoringFailure,      // A registered region cannot be monitored   kCLErrorRegionMonitoringSetupDelayed, // CL could not immediately initialize region monitoring   kCLErrorRegionMonitoringResponseDelayed, // While events for this fence will be delivered, delivery will not occur immediately   kCLErrorGeocodeFoundNoResult,         // A geocode request yielded no result   kCLErrorGeocodeFoundPartialResult,    // A geocode request yielded a partial result   kCLErrorGeocodeCanceled,              // A geocode request was cancelled   kCLErrorDeferredFailed,               // Deferred mode failed   kCLErrorDeferredNotUpdatingLocation,  // Deferred mode failed because location updates disabled or paused   kCLErrorDeferredAccuracyTooLow,       // Deferred mode not supported for the requested accuracy   kCLErrorDeferredDistanceFiltered,     // Deferred mode does not support distance filters   kCLErrorDeferredCanceled,             // Deferred mode request canceled a previous request   };   typedef NSInteger CLError;    
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved