2

I'm using CLGeocoder to get the location of an address. The CLGeocoder returns latitude and longtitude successfully when my code is running in the iPad device with iOS 5.1 and also in the iPhone/iPad Simulator. On the contrary, when I'm running my code in my iPhone 4 device with iOS 6.0.1, it returns an error with message:

PBRequester failed with Error Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “gsp-ssl.ls.apple.com” which could put your confidential information at risk." UserInfo=0x2287c720 {NSErrorFailingURLStringKey=https://gsp-ssl.ls.apple.com/fwdgeo.arpc, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, NSErrorFailingURLKey=https://gsp-ssl.ls.apple.com/fwdgeo.arpc, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “gsp-ssl.ls.apple.com” which could put your confidential information at risk., NSUnderlyingError=0x22893b70 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “gsp-ssl.ls.apple.com” which could put your confidential information at risk.", NSURLErrorFailingURLPeerTrustErrorKey=}

My code using CLGeocoder in my .m file:

geocoder = [[CLGeocoder alloc] init];

    [geocoder geocodeAddressString:location completionHandler:^(NSArray* placemarks, NSError* error){
        if (error != noErr)
        {
            // An error occurred with the request.
            [self locationRequestFailed];
        }
        else
        {
            // Fetch coordinates from Geocoder.
            for (CLPlacemark* aPlacemark in placemarks)
            {
                // Process the placemark.
                NSString *latitude = [NSString stringWithFormat:@"%f",aPlacemark.location.coordinate.latitude];
                NSString *longitude = [NSString stringWithFormat:@"%f",aPlacemark.location.coordinate.longitude];

                // Process latitude and longitude.
                [self locationRequestSucceededWithLatitude:[latitude doubleValue] andLongitude:[longitude doubleValue]];
            }
        }
    }];

Is there a bug on iPhone 4 6.0.1 or I'm doing something wrong with my iPhone 4?

4

0 回答 0