ios - Cannot load a particular website into UIWebView: NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) -
ios - Cannot load a particular website into UIWebView: NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) -
i have seen multiple questions on certificates beingness problem none of answers seem work. error when trying run it: nsurlconnection/cfurlconnection http load failed (kcfstreamerrordomainssl, -9813)
here .h file
#import <uikit/uikit.h> @interface viewcontrollerwebadvisor : uiviewcontroller @property (strong, nonatomic) iboutlet uibutton *mainmenubutton; @property (strong, nonatomic) iboutlet uiwebview *webview; @property (strong, nonatomic) iboutlet uilabel *loadinglabel; @end
here .m file:
#import "viewcontrollerwebadvisor.h" @interface viewcontrollerwebadvisor () @end @implementation viewcontrollerwebadvisor - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } homecoming self; } - (void)viewdidload { [super viewdidload]; _webview.scalespagetofit = yes; nsurl *url = [nsurl urlwithstring:@"http://tookoutsitenamebecauseiconsideritpersonal.ca"]; nsurlrequest *requesturl = [nsurlrequest requestwithurl:url]; [_webview loadrequest:requesturl]; _mainmenubutton.layer.cornerradius = 10; _mainmenubutton.layer.bordercolor=[uicolor blackcolor].cgcolor; _mainmenubutton.layer.borderwidth=2.0f; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (void)webviewdidstartload:(uiwebview *)webview { _loadinglabel.text = @"loading..."; } - (void)webviewdidfinishload:(uiwebview *)webview { _loadinglabel.text = @""; } @end
any help appreciated.
from apple document, can disable certificate checks below code. add together them in appdelegate.m
@implementation nsurlrequest(datacontroller) + (bool)allowsanyhttpscertificateforhost:(nsstring *)host { homecoming yes; } @end
this link apple document https://developer.apple.com/library/ios/technotes/tn2232/_index.html#//apple_ref/doc/uid/dts40012884-ch1-secintroduction
hope helps
ios uiwebview
Comments
Post a Comment