Search code examples
iosibm-mobilefirst

Native page rendering error with WL.NativePage.Show procedure using


I created a hybrid application that open a native page. If the UIViewController which assigned to the opened page is objective-c type, then the page is well open. However, when Swift-type of the UIViewController, the Xcode throw the following error:

WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: *** setObjectForKey: object cannot be nil (key: SwiftTestPage)

What can cause this error? Thanks for your help.


Solution

  • Note that WL.Nativpage.show does not support Swift, using it like that may have unforseen consequences, like the one you are experiecing now.

    Instead of WL.Nativepage.show, you should use the Action Sender API to call up any class ("page") you want, without the restrictions placed by WL.Nativepage. See here: http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/devref/c_action_sender.html