2010-11-24 57 views
1

是否有使用CLLocationManager索要一次性的位置,說:「當我按下這個按鈕,告訴我,我在哪裏」,或只是調用一個關閉位置的請求?

[locationManager startUpdatingLocation]; 
// and implementing: locationManager:didUpdateToLocation:fromLocation: 
[locationManager stopUpdatingLocation]; 

回答

2

簡短的回答的情況下,相當於一種方式:不。

可能需要一些時間才能獲取位置,這就是CLLocationManager使用委託的原因。您必須在回調locationManager:didUpdateToLocation:fromLocation:中撥打stopUpdating的位置。

+0

非常感謝羅伯特。 – fuzzygoat 2010-11-24 18:07:37