Hello,
I am opening an url using UIwebview object in order to open it directly and not necessary to pass through safari. It works properly since I try to access to a url that user and pass are required. It doesn't display anything.
When this url is opened on safari, it asks for user and pass and once are introduced, url is opened properly but when using uiwebview object, it doesn't ask for user and pass and uiwebview keeps in white background, nothing displayed.
I am still trying to implement it with authentication but no success, I tried some different methods and delegations and same result. Always webview object keeps in white. Am I missing any delegation or step? thanks for help
I am opening an url using UIwebview object in order to open it directly and not necessary to pass through safari. It works properly since I try to access to a url that user and pass are required. It doesn't display anything.
When this url is opened on safari, it asks for user and pass and once are introduced, url is opened properly but when using uiwebview object, it doesn't ask for user and pass and uiwebview keeps in white background, nothing displayed.
I am still trying to implement it with authentication but no success, I tried some different methods and delegations and same result. Always webview object keeps in white. Am I missing any delegation or step? thanks for help
Code:
-(void)viewDidLoad {
NSString *urlAddress = @http://"www.testweb.com";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:requestObj
delegate:self];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
[super viewDidLoad];
}
- (void)connectionNSURLConnection *)theConnection didReceiveAuthenticationChallengeNSURLAuthentica tionChallenge
*)challenge {
NSLog(@"got auth challange");
if ([challenge previousFailureCount] == 0) {
[[challenge sender] useCredential:[NSURLCredential credentialWithUser:@"demo" password:@"demo"
persistence:NSURLCredentialPersistenceNone] forAuthenticationChallenge:challenge];
} else {
[[challenge sender] cancelAuthenticationChallenge:challenge];
}
}