ios - WKWebView randomly not loading FacebookLike-Button (via WPZoom Social Plugin) -
i'm made app fetches posts wordpress-site via api, presents title , excerpt in uitableviewcontroller , if user taps cell post presented (via segue) in uiviewcontroller-subclass containing wkwebview.
the uiviewcontroller subclass handles navigationdelegate , uidelegate of webview.
so far works fine.
but comes weird behaviour: wordpress-page has whatsapp-button , facebook-like , facebook-share button
the whatapp-button , facebook-share (the 1 @ end of row) work without problem. like-button not work. strange thing appears not react anything, @ least none of delegates called)
what find out better network-connection better button works. i.e. had problem in 1 out of twenty. didn't realised before colleague (who has terrible internet connection) informed me problem.
my guess is, problems must on server side, works in mobile safari , android version works without problems.
so, has clue problem , how solve it?
to handle like-action implemented
func webview(_ webview: wkwebview, createwebviewwith configuration: wkwebviewconfiguration, navigationaction: wknavigationaction, windowfeatures: wkwindowfeatures) -> wkwebview?
as can see below
func webview(_ webview: wkwebview, createwebviewwith configuration: wkwebviewconfiguration, navigationaction: wknavigationaction, windowfeatures: wkwindowfeatures) -> wkwebview? { if let popup = self.popupwebview { popup.uidelegate = nil popup.removefromsuperview() self.popupwebview = nil } let popup = wkwebview(frame: cgrect.zero, configuration: configuration) popup.translatesautoresizingmaskintoconstraints = false popup.uidelegate = self self.view.addsubview(popup) let webviewconstraints = [nslayoutconstraint(item: popup, attribute: nslayoutattribute.left, relatedby: nslayoutrelation.equal, toitem: self.view, attribute: nslayoutattribute.left, multiplier: 1, constant: 0), nslayoutconstraint(item: popup, attribute: nslayoutattribute.top, relatedby: nslayoutrelation.equal, toitem: self.view, attribute: nslayoutattribute.topmargin, multiplier: 1, constant: 0), nslayoutconstraint(item: popup, attribute: nslayoutattribute.right, relatedby: nslayoutrelation.equal, toitem: self.view, attribute: nslayoutattribute.right, multiplier: 1, constant: 0), nslayoutconstraint(item: popup, attribute: nslayoutattribute.bottom, relatedby: nslayoutrelation.equal, toitem: self.view, attribute: nslayoutattribute.bottommargin, multiplier: 1, constant: 0)] self.view.addconstraints(webviewconstraints) self.popupwebview = popup return popup
}
Comments
Post a Comment