MapkitFrameworkの使用を開始しました。ここからサンプルコードを入手しました。
しかし、コードをビルドすると、次のエラーが返されます。
/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407
地図は表示されません。
コードにエラーがあるのか、Googleサービスにエラーがあるのか混乱しています。
MapkitFrameworkの使用を開始しました。ここからサンプルコードを入手しました。
しかし、コードをビルドすると、次のエラーが返されます。
/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)
最初にsharedCredentialStorage(1)を回復し、次にユーザー名、パスワード、および使用する永続性のタイプ(2)を含む新しいNSURLCredentialを作成しました。その後、2つのNSURLProtectionSpace(3)(4)を作成しました。1つはHTTPS Connexion用で、もう1つはHTTPConnexion用です。
そして最後に、NSURLCredentialをこれらのProtectionSpacesのsharedCredentialStorageに追加しました(5)(6)
このコードがお役に立てば幸いです
はい、Mapkitフレームワークが含まれています。viewDidLoadエラーが発生した後、どのデリゲートメソッドがこのエラーを発生させているのか正確にはわかりません。