1

MapkitFrameworkの使用を開始しました。ここからサンプルコードを入手しました。

しかし、コードをビルドすると、次のエラーが返されます。

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

地図は表示されません。

コードにエラーがあるのか​​、Googleサービスにエラーがあるのか​​混乱しています。

4

2 に答える 2

2

解決策を見つけました。ユーザーのキーチェーンにクレデンシャルを追加する必要があります。これが私のコードです。

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)

このコードがお役に立てば幸いです

于 2010-06-01T18:48:41.053 に答える
0

はい、Mapkitフレームワークが含まれています。viewDidLoadエラーが発生した後、どのデリゲートメソッドがこのエラーを発生させているのか正確にはわかりません。

于 2009-12-08T10:23:09.820 に答える