When I start loading my UIWebView it gives me this error:
2015-06-12 10:24:08.768 App[7034:692175] Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x165f3950 {NSErrorFailingURLKey=https://google.com/, NSErrorFailingURLStringKey=https://google.com/}
And it never finishes loading. The weird part is: When I execute it on the simulator it works just fine. Also when I reload the webview by hand it works fine as well.
Therefore it means the URL and it's parameters are just fine(https://google.com/ is not the actual URL).
Online I found this workaround:
if([error code] == NSURLErrorCancelled){
return;
}else{
//Actual error handling
}
This does get called, but doesn't solve the issue
EDIT: _
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, self.infoView.frame.size.width, self.infoView.frame.size.height)];
[self.infoView addSubview:_webView];
[_webView setHidden:YES];
_webView.scalesPageToFit = YES;
_webView.delegate = self;
_webView.scrollView.scrollEnabled = NO;
_webView.scrollView.bounces = NO;
[_webView setUserInteractionEnabled:YES];
[_webView addSubview:invisView];
[_webView loadRequest:[self getRequest]];
This appears to be a bug in iOS with HTTPS requests. A workaround for me was redoing the request when the error is given. The second time the request seemed to load fine and it works perfectly now.