2013-08-21 49 views
0

我想在使用CCLocationManager時模擬失敗。我今天使用的代碼就是這樣的。使用CCLocationManager模擬失敗

首先啓動位置更新thingy。

[locationManager startUpdatingLocation]; 

如果東西失敗

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
{ 
    [locationManager stopUpdatingLocation]; 
    [[ActivityIndicator sharedInstance] hide]; 
} 

然而,東西永遠不會失敗,似乎和我想從模擬的LocationManager一個真正的錯誤。問題的根源在於我有一些用戶表示,由於ActivityIndi​​cator阻礙,位置搜索從不會結束,導致出現塊。

任何提示?

回答

0

我在ipod touch 4g上經歷了同樣長的位置測量時間。
而不是嘗試以手動方式觸發didFailWithError,嘗試使用延遲30s的NSTimer(應該沒事,可以根據需要調整),調用stopupdatinglocation,隱藏您的活動指示符並向用戶顯示錯誤消息。