Objective c 在Webview中打开来自服务器的URL
在我的iPad应用程序中,我使用的Webview工作得非常好,可以从服务器打开URL。 在我的一个URL中,我收到的问题URL如下: www.google.com 如果上面的URL是我放在网上的,它只是以https前缀打开的…我的URL可以是任何类型的…并且取决于用户的输入Objective c 在Webview中打开来自服务器的URL,objective-c,ipad,webview,Objective C,Ipad,Webview,在我的iPad应用程序中,我使用的Webview工作得非常好,可以从服务器打开URL。 在我的一个URL中,我收到的问题URL如下: www.google.com 如果上面的URL是我放在网上的,它只是以https前缀打开的…我的URL可以是任何类型的…并且取决于用户的输入 是否有任何通用方法打开上述URL…您可能必须实现NSURLConnectionLegate NSURL *homeURL = [NSURL URLWithString:[self URLEncodeString:URL]];
是否有任何通用方法打开上述URL…您可能必须实现NSURLConnectionLegate
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];
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response