0

私のアプリケーションでは、reverseGeocoderは以下のエラーブロックのようになります。

didFailWithError:Error Domain = NSURLErrorDomain Code = -1011 "操作を完了できませんでした。(NSURLErrorDomainエラー-1011)" UserInfo = 0x6252100 {PBHTTPStatusCode = 503}

これは私が使用したコードです:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { 

     geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate];
     [geocoder setDelegate:self];
     [geocoder start];
    [locationManager stopUpdatingLocation];
}   
-(void)reverseGeocoder:(MKReverseGeocoder *)geocoder1 didFailWithError:(NSError *)error
{
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"iBeen There" message:@"GPS can't track the location please check the internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    [alert release];
    NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error);
}

初めてエラーブロックになります(時々)。何か足りないものがありますか?助けてください。

4

1 に答える 1

0

エラー-1011はBadServerResponse(ここのアップルのドキュメントから)であり、HTTPステータスコードは503(サービスは利用できません)です。

だから、あなたが彼らに無効なデータを与えない限り、それは彼らの終わりの問題だと思います!

ただし、チェックを検討する可能性のあるいくつかのエッジケースがあります。

(1)座標の値は何ですか?無効な場合、ジオコーダーはおそらく何らかのエラーを返します(ただし、おそらく503を返すべきではありません;)

(2)プロキシ/ Web認証の背後にいますか?実際にジオコーディングサービスと話しているのではなく、プロキシと話しているので、おそらく何をしようとしているのか理解できません!

于 2011-09-16T11:19:57.423 に答える