when i was trying to load a url in the uiWebView, my NSURL object is always nil when i init it this way:
NSURL *url = [[NSURL alloc] initWithString: urlString];
This is because:
If the string was malformed, returns nil.
This method expects URLString to contain any necessary percent escape codes, which are ‘:’, ‘/’, ‘%’, ‘#’, ‘;’, and ‘@’. Note that ‘%’ escapes are translated via UTF-8.
So I have to init it as follows:
NSURL *url = [[NSURL alloc] initWithString: [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];