在Webview中打开来自Server的URL

时间:2015-10-13 18:40:38

标签: objective-c ipad webview

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 App我正在使用Webview(工作得非常好),打开URL来自Server。 在我的一个URL中,我得到的问题URL如下:

www.google.com

如果上面的网址我放在网上它只是用https前缀打开....我的网址可以是任何类型......并且取决于用户输入....

是否有任何通用方法可以打开上面的网址....

1 个答案:

答案 0 :(得分:0)

您可能必须实施NSURLConnectionDelegate。

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

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

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
相关问题