Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIWebView won't load links with certificate (https:// prefix)

I know this has been asked before but I have looked at every answer (there aren't many) and none help me.

The issue I am running into is dealing with certificates with my schools e-mail service. The links for the two e-mail services are here:

Main school e-mail: https://marauder.millersville.edu/mail/index.pl

Computer Science e-mail: https://cs.millersville.edu/cswebmail

University student portal (Marauder Mail button on the right doesn't open when clicked in my UIWebView)
http://myville.millersville.edu/

At first neither of the websites would load in my UIWebView using a standard NSURL and NSURLRequest. I looked on the web for a solution and someone suggested using the NSURLProtocolClient delegate methods. After implementing them, my UIWebView will now load the schools mail e-mail ONLY when I have a button that when clicked opens the link directly, as opposed to trying to access the mail from the portal site (3rd link above), and it still never loads the computer science e-mail link. I have scoured the iOS help sites, posted questions, tried multiple open-source custom UIWebViews, but I have not found anything that works.

Most answers I have read around the web point to ASIHTTPRequest. I have tried this but I cannot implement it right, it doesn't load the links in my UIWebView; here is my code for how I am loading a link:

mURL = [self getURL:viewNumber];
ASIHTTPRequest *req = [ASIHTTPRequest requestWithURL:mURL];
[req setDelegate:self];
[req startSynchronous];

//NSURLRequest *req = [NSURLRequest requestWithURL:mURL];
//urlConnection=[[NSURLConnection alloc] initWithRequest:req delegate:self];
webView.scalesPageToFit = YES;
//[webView loadRequest:req];

Code in comments is how I load a link without ASIHTTPRequest.

Any help is appreciated!

Also, I have another issue with my UIWebView, link is below. I haven't had any answers so if you're bored please check it out: UIWebView doesn't detect text box on website

like image 382
RyanG Avatar asked Nov 05 '22 00:11

RyanG


1 Answers

Fixed my issue, I was able to load https with no problem with the following code I didn't think this would work but it does!:

NSURLRequest *req = [NSURLRequest requestWithURL:mURL];
urlConnection=[[NSURLConnection alloc] initWithRequest:req delegate:self];
webView.scalesPageToFit = YES;
[webView loadRequest:req];
like image 100
RyanG Avatar answered Nov 12 '22 20:11

RyanG