swift – Cordova bridge not firing after biometric passcode fallback on iOS (machine prepared / doc.prepared not triggered)


We face a difficulty in our iOS Cordova hybrid app (WKWebView) throughout biometric → passcode fallback authentication.

Setting:

Cordova iOS 7.x (WKWebView)
Native plugin handles Face ID / Contact ID and passcode fallback
Net layer ( ServletController) hundreds pages by way of server-side ahead (not a full navigation)

Challenge Description:

  • When biometric authentication succeeds → all the things works usually.
  • When passcode login is used straight → additionally works.

However when biometric fails and falls again to passcode, the next occurs:

Native plugin sends two callbacks (biometric fail → passcode success). The passcode success callback hundreds the house web page inside the identical WKWebView. The HTML is displayed, however doc.prepared and deviceready by no means fireplace. Any Cordova name (e.g., showHomeScreeninApp(“success”)) throws ReferenceError: Cannot discover variable: cordova. If the consumer minimizes and reopens the app, all the things abruptly begins working.

What we suspect:

The native UIViewController dealing with the passcode display screen tears down or detaches the Cordova bridge when it’s dismissed, so the WebView context stays however the bridge is gone. The online content material reloads by way of Servlet ahead, however no new lifecycle occasions are triggered.

Tried to this point:

  • JS workaround that reinjects cordova.js and re-fires deviceready → works quickly.
  • Verified that cordova.js is current and loaded.
  • Challenge solely occurs on iOS, not Android.

Anticipated Behaviour:

After passcode success (even when biometric failed first), the WKWebView ought to retain its Cordova bridge and set off the conventional deviceready / JS lifecycle so the house web page runs appropriately.

Query:

What modifications are wanted on the native iOS facet (plugin or WKWebView lifecycle) to maintain the Cordova bridge lively or reattach it correctly after the biometric→passcode transition?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles