for(int i=0; i<arrString.count;i++){
if([[arrString objectAtIndex:i] rangeOfString:@"www."].location != NSNotFound)
link = [arrString objectAtIndex:i];
}
NSString *url = (@"THIS IS WHERE HTTP:// would Be!%@", link);
NSLog(@"THIS IS WHERE HTTP:// would Be!%@", url);
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[_webView1 loadRequest:nsrequest];
当我使用NSLog时:
NSLog(@"THIS IS WHERE HTTP:// would Be!, url);
它记录以http://.
开头的正确URL但是,当我将字符串URL设置为http://"link"
时,它不会返回任何内容。任何帮助深表感谢。
(Stack Overflow不让我把真正的HTTP://后跟%@。)
答案 0 :(得分:1)
看起来您可能需要使用stringWithFormat:
NSString *domainName = @"aol.com";
NSString *url = [NSString stringWithFormat:@"http://www.%@", domainName];