views:

271

answers:

2

I just started the use of Mapkit Framework. I got a sample code from here.

But when I build the code it returns the following error.

/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407

It does not shows the map.

I am confused whether the code has an error or there is some error with Google services.

A: 

Yes we have included Mapkit framework.After viewDidLoad error is coming ,don't have exact idea from which delegate method is giving this error

Roger_iPhone
+1  A: 

I have found a solution, we need to add Credentials to user's keychain here is my code [CODE] NSURLCredentialStorage * credentialStorage=[NSURLCredentialStorage sharedCredentialStorage]; (1) NSURLCredential * newCredential; newCredential=[NSURLCredential credentialWithUser:@"myUserName" password:@"myPWD" persistence:NSURLCredentialPersistencePermanent];(2) NSURLProtectionSpace * mySpaceHTTP=[[NSURLProtectionSpace alloc] initWithProxyHost:@"ipProxy" port:port type:NSURLProtectionSpaceHTTPProxy realm:nil authenticationMethod:nil];(3) NSURLProtectionSpace * mySpaceHTTPS=[[NSURLProtectionSpace alloc] initWithProxyHost:@"ipProxy" port:port type:NSURLProtectionSpaceHTTPSProxy realm:nil authenticationMethod:nil];(4) [credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTP];(5) [credentialStorage setCredential:newCredential forProtectionSpace:mySpaceHTTPS];(6) [/CODE]

I recovered first the sharedCredentialStorage (1), then i created new NSURLCredential containing my user name, password, and the type of persistence to use (2) . After that I created two NSURLProtectionSpace (3)(4): one for HTTPS Connexion, and one for HTTP Connexion

And finally, i added NSURLCredential the sharedCredentialStorage for these ProtectionSpaces (5)(6)

I hope that this code can help you

asrekik