我刚开始使用Mapkit Framework。 我从here得到了一个示例代码。iPhone MapKit错误
但是,当我构建代码时,它返回以下错误。
/SourceCache/GoogleMobileMaps/GoogleMobileMaps-201/googlenav/mac/Loader.mm:195 server returned error: 407
它不显示地图。
我很困惑代码是否有错误或者Google服务存在一些错误。
我刚开始使用Mapkit Framework。 我从here得到了一个示例代码。iPhone MapKit错误
但是,当我构建代码时,它返回以下错误。
/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),然后创建新NSURLCredential,和类型的持久性 使用(2)。之后,我创建了两个NSURLProtectionSpace(3)(4):一个用于HTTPS联接,一个用于HTTP联接
最后,我加入NSURLCredential的sharedCredentialStorage这些ProtectionSpaces(5)(6)
希望该代码可以帮助您
是的,我们已经包括Mapkit framework.After viewDidLoad中的错误来了,没有确切的想法从委托方法是给这个错误
您是否包含MapKit框架?这个错误发生在什么时候? – lyonanderson 2009-12-08 09:19:55
如果您不知道在哪里查找它:错误407意味着“需要代理验证”。 – 2009-12-08 10:29:48