2015-10-13 28 views
0
NSURL *homeURL = [NSURL URLWithString:[self URLEncodeString:URL]]; 
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:homeURL]; 

    //Set our self as the webview delegate (so methods below will be called) 
    [myWebView setDelegate:self]; 

    //Start loading the webview's request 
    [myWebView loadRequest:request]; 

在我的iPad应用程序我使用的是Webview(完美地工作),打开来自服务器的URL。 在我的网址我得到的问题URL的一个是如下:在Webview中来自服务器的打开URL

www.google.com

如果上述网址我把网只是以https前缀开放....我的URL可以是任何一种...并取决于用户输入的....

有打开上述网址,任何通用的方法....

回答

0

您可能必须实施NSURLConnectionDelegate。

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace 

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge 

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response