我正在使用带有 KML 查询的 Google 地图。但我的查询字符串是“日语”字符串“マクドナルド”我正在使用http://maps.google.co.jp。请求数据时,我得到“0”字节。但是当我在浏览器中输入相同的查询时,它会下载一个 KML 文件。我的代码如下:
query = [NSString stringWithFormat:@"http://maps.google.co.jp/maps?&near=%f,%f&q=マクドナルド&output=kml&num=%d", lat,lon, num];
NSURL* url = [NSURL URLWithString:query]; NSURLRequest* request = [NSURLRequest requestWithURL:url]; NSLog(@"查询 URL = %@", url);
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] autorelease];
NSData *myData = [NSURLConnection sendSynchronousRequest:request returningResponse: &response error: nil ];
NSInteger errorcode = [response statusCode];
我收到 0 个字节的“myData”。为什么?