iPhone MapKitエラー
-
18-09-2019 - |
質問
私はちょうどMapkitフレームワークの使用を開始しました。 私は<のhref =「http://blog.objectgraph.com/index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/」のrel = "nofollowをからのサンプルコードを得ましたnoreferrer ">ここを。
しかし、私は、コードをビルドするとき、それは、次のエラーを返します。
/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407
これは、マップを示しません。
私はコードがエラーを持っているか、Googleのサービスといくつかのエラーがあるかどうか混乱しています。
解決
私は解決策を発見した、我々は、ユーザのキーチェーンに資格情報を追加する必要があります ここに私のコードです。
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)
私が最初に回復し(1)、その後、私は自分のユーザー名、パスワード、およびタイプを含む新しいNSURLCredentialを作成sharedCredentialStorage (2)を使用する持続性の。その後私が作成された2つのNSURLProtectionSpace(3)(4):HTTPS Connexionのための1つ、およびHTTP Connexionのための1つの
最後に、私はこれらのProtectionSpacesためNSURLCredentialにsharedCredentialStorageを加え(5)(6)
私はこのコードはあなたを助けることができることを願っています。
他のヒント
はい、我々はMapkit framework.AfterのviewDidLoadエラーが来ているが含まれている、デリゲートメソッドは、
このエラーを与えているから正確なアイデアを持っていません所属していません StackOverflow