WebKitErrorDomain错误101(在mapview中)

时间:2011-09-28 11:37:41

标签: iphone

这是我的代码我收到此错误

NSString *url = [NSString stringWithFormat:@"%@?lat=%@&long=%@",
                 [[NSBundle mainBundle] pathForResource:@"map" ofType:@"html"],
                 @"17.734503", 
                 @"83.2999716"];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
DirctionWeb.delegate = self;
[DirctionWeb loadRequest:request];

所以在这里我将网页连接到谷歌地图html页面为什么这个错误信息请指导我

1 个答案:

答案 0 :(得分:0)

确保网址编码正确并且在纬线和长线上都有+ - ,如下所示:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://maps.google.com/?q=+17.734503,+83.2999716"]];
DirctionWeb.delegate = self;
[DirctionWeb loadRequest:request];

所以,替换这个:

NSString *htmlFile = [NSString stringWithFormat:@"%@?lat=%@&long=%@",
                 [[NSBundle mainBundle] pathForResource:@"map" ofType:@"html"],
                 @"17.734503", 
                 @"-83.2999716"];

使用:

NSString *htmlFile = [NSString stringWithFormat:@"%@?lat=+.000000f&long=%+.000000f",
                 [[NSBundle mainBundle] pathForResource:@"map" ofType:@"html"],
                 @"17.734503", 
                 @"-83.2999716"];