//把string以UTF8編碼
NSString* returnValue =
[URLstring stringByAddingPercentEscapesUsingEncoding:
NSUTF8StringEncoding];
例如:
//要先將中文地址轉成UTF8型式,才可做為查詢網址。
NSString* address = [@"台北巿南港區三重路19-11號" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: [NSString stringWithFormat:@"http://maps.apple.com/maps?q=%@",address]]];
//NSURL to NSString NSURL
NSString *returnValue = [URL absoluteString];
沒有留言:
張貼留言