我刚开始使用 Mapkit 框架。我从这里得到了一个示例代码。
但是当我构建代码时,它会返回以下错误。
/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407
它不显示地图。
我很困惑代码是否有错误或谷歌服务有错误。
我刚开始使用 Mapkit 框架。我从这里得到了一个示例代码。
但是当我构建代码时,它会返回以下错误。
/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407
它不显示地图。
我很困惑代码是否有错误或谷歌服务有错误。
我找到了解决方案,我们需要将凭据添加到用户的钥匙串这是我的代码
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),然后创建了新的 NSURLCredential,其中包含我的用户名、密码和要使用的持久性类型 (2)。之后我创建了两个 NSURLProtectionSpace (3)(4):一个用于 HTTPS Connexion,一个用于 HTTP Connexion
最后,我为这些 ProtectionSpaces 添加了 NSURLCredential 和 sharedCredentialStorage (5)(6)
我希望这段代码可以帮助你
Yes we have included Mapkit framework.After viewDidLoad error is coming ,don't have exact idea from which delegate method is giving this error