您好我尝试使用此功能打开当前位置的地图应用,并获取指示我为路线指定的任何内容。当我点击iPhone上的按钮时,没有任何反应,但它被点击了。我做错了什么?
NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=Current+Location&daddr=%@ %@ %@ %@",
streetString , cityString, stateString, zipString];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
答案 0 :(得分:0)
确保使用stringByAddingPercentEscapesUsingEncoding
转义NSStringNSString *url = [NSString stringWithFormat: @"http://maps.google.com/mapssaddr=Current+Location&daddr=%@ %@ %@ %@", streetString , cityString, stateString, zipString];
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];