ios - WKWebView programmatically reload trigger didFailProvisionalNavigation -
a uisplitviewcontroller
base app, master uitableviewcontroller
, detail uiviewcontroller
.
when uitableviewcontroller
cell taps, nsnotificationcenter
post notification
, reload wkwebview
in detailviewcontroller
.
reload successlly, trigger wknavigationdelegate [webview:didfailprovisionalnavigation:witherror:], why????
masterviewcontroller
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { dispatch_async(dispatch_get_main_queue(), ^{ [[nsnotificationcenter defaultcenter]postnotificationname:anotification object:nil]; }); }
detailviewcontroller
- (void)viewdidload { [super viewdidload]; [[nsnotificationcenter defaultcenter]addobserver:self selector:@selector(__shouldreload:) name:anotification object:nil]; } - (void)__shouldreload:(nsnotification *)sender { [_webview reload]; }
this caused "app transport security". can either use https or can set exception in info.plist.
<key>nsapptransportsecurity</key> <dict> <key>nsallowsarbitraryloads</key> <true/> </dict>
what wwdc video networking nsurlsession
app transport security
app transport security (ats) enforces best practices in secure connections between app , end. ats prevents accidental disclosure, provides secure default behavior, , easy adopt; on default in ios 9 , os x v10.11. should adopt ats possible, regardless of whether you’re creating new app or updating existing one.
if you’re developing new app, should use https exclusively. if have existing app, should use https as can right now, , create plan migrating rest of app possible. in addition, communication through higher-level apis needs encrypted using tls version 1.2 forward secrecy. if try make connection doesn't follow requirement, error thrown. if app needs make request insecure domain, have specify domain in app's info.plist file.
Comments
Post a Comment