我使用CLLocationManager
搶location.Though I have GPS settings working on my device
CLLocation deletgate方法,它顯示隨機狀態彈出這是在didFailWithError
iphone:所謂隨機
錯誤我收到定義是,
Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
-(void) startGettingCurrentLocation {
CLLocationManager *locationManager=[[CLLocationManager alloc] init];
locationManager.delegate=self;
locationManager.desiredAccuracy=kCLLocationAccuracyNearestTenMeters;
[locationManager startUpdatingLocation];
}
- (void) locationManager:(CLLocationManager *) manager didFailWithError:(NSError *)error {
[locatingAlert dismissWithClickedButtonIndex:0 animated:NO];
UIAlertView *statusAlert;
statusAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"In order to use this application properly, you need to allow use of the GPS." delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
[statusAlert addButtonWithTitle:@"OK"];
[statusAlert show];
//Set Default Coordinates it app not able to get location
if (mainDelegate.currentLatitude == nil) {
mainDelegate.currentLatitude = @"28.6317021";
}
if (mainDelegate.currentLongitude == nil) {
mainDelegate.currentLongitude = @"-81.423110";
}
}
請看看這個http://mobileorchard.com/hello-there-a-corelocation-tutorial/ –
你是怎麼調用這個委託的? –
沒有它本身稱爲 – Heena