2011-08-09 83 views

回答

6

在iOS 5之前,從第三方應用程序啓動手機設置的行爲並不一致,但在iOS5中,這得到了改進。

如果我們調用startUpdatingLoaction方法如下代碼,並且位置服務關閉,系統警報將彈出,如果我們點擊設置按鈕,它將導航到手機設置。

CLLocationManager *locationManager = [[CLLocationManager alloc] init]; 
locationManager.delegate = self; 
[locationManager startUpdatingLocation]; 
5

那麼GPS將會打開,如果你使用CLLocationManager

locationmanager將首先通過三角測量獲取位置,然後轉動GPS以獲得更精確的修正。

12

一個簡單的例子:

//Init location manager 

CLLocationManager* locationManager = [ [ CLLocationManager alloc] init]; 
locationManager.delegate = self; //we must implement the protocol 

//Choose your accuracy level 

//To turn on gps (if it isn't on already) 
[locationManager startUpdatingLocation]; 

//To turn gps off (if no other apps are listening) 
[locationManager stopUpdatingLocation]; 

還有比這更多,並且可以監視或多或少的準確性,甚至使用WIFI /手機信號塔。請首先閱讀示例以獲得最佳使用。

相關問題