UIWebView load url with UTF8 char

剛剛遇到的,如果有跟API query的參數有UTF8 char的話也是一樣解法:
NSString* urlStr = @"https://maps.google.com.tw/maps?q=加油站";
NSURL *url = [NSURL URLWithString:[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.gasWebView loadRequest:request];
view raw gistfile1.m hosted with ❤ by GitHub

沒有留言: