I Referred a many links related to this issue,But I cannot able to find the answer.I am getting a dynamic url in my app...If the url
contains http://www then it opens the link,If www
is not present then this error occurs.Any Help on this.
I am using this code,
NSString *selectedurl=[self.SelectedItem objectForKey:@"url"];
selectedurl=[selectedurl stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSURL *url=[NSURL URLWithString:selectedurl];
if (url.scheme.length == 0)
{
selectedurl = [@"http://" stringByAppendingString:selectedurl];
url = [[NSURL alloc] initWithString:selectedurl];
}
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:selectedurl]])
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:selectedurl]];
}