开发者

problem with loading a url into safari

I am using the below code to load a url into safari (iphone):

开发者_StackOverflow
NSString *gotoURL = [self getPostID:indexPath.row];
//NSLog(gotoURL );
NSURL *url = [ [ NSURL alloc ] initWithString:gotoURL];
[[UIApplication sharedApplication] openURL:url];

the code works if I replace gotoURL with : @"http://www.example.com" but it wont if I replace it.

The gotoURL gets a url from getPostID (which also returns a NSString) and I did an nslog as you can see and the url format seems fine.

Any idea why its not working?


From what you've added, it is likely that you're missing the protocol in the url. The string passed must be http://domain.tld/4Mi.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜