I´m trying to open an URL with UIApplication, but when I run:
[[UIApplication sharedApplication] canOpenURL:urlToUpdate
The url is created with a String and
NSString *urlStringToOpenEscaped = [urlStringToOpen stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urlToUpdate = [NSURL URLWithString:urlStringToOpenEscaped];
Always returns FALSE.
I checked the URL is accessible from the iPad.
Any idea?
The
canOpenURLmethod is not meant to be used in order to test if a network url is reachable. According to the documentation:So, it’s a way of knowing if the resource specified by the url passed to the method, can be accessed/opened by an application on the system.
If you want to check whether a web address is reachable or not you’ll have to execute the request and then handle the result in the response.