2012-04-26 44 views

回答

2

你應該這樣做: 第二行很重要。

NSString *urlstr=[NSString stringWithFormat:@"www.ModelAirplane.ir/هاشم"]; 

urlstr = [urlstr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 

NSURL * url=[NSURL URLWithString:urlstr]; 
NSLog(@"%@",url.description); 
1

here

此使用在 夫特2.0

let = "http://example.ir/اسم-عربي" 
let safeURL = urlStr.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! 

參考