chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 556 forks source link

Callback not working with new standard WKWebView, fallback to UIWebView required #298

Closed No0ne closed 6 years ago

No0ne commented 6 years ago

https://github.com/chariotsolutions/phonegap-nfc/blob/fdba79f489f195c0ff8d8b4e98b2ecb8cb97e8c4/src/ios/NfcPlugin.m#L118

There is code missing (e.g. 'evaluateJavaScript') to make it work with the new standard WKWebView. Currently the only solution is to use UIWebView as a fallback by putting <preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" /> into the apps config.xml.

No0ne commented 6 years ago

Xcode output after scanning a tag: 2017-10-30 09:44:42.260887+0100 MyApp[3369:2035346] -[WKWebView stringByEvaluatingJavaScriptFromString:]: unrecognized selector sent to instance 0x102031a00 2017-10-30 09:44:42.261806+0100 MyApp[3369:2035552] didInvalidateWithError Single tag read (null) 2017-10-30 09:44:42.265144+0100 MyApp[3369:2035346] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[WKWebView stringByEvaluatingJavaScriptFromString:]: unrecognized selector sent to instance 0x102031a00' *** First throw call stack: (0x186a9bd38 0x185fb0528 0x186aa91f8 0x190263cc4 0x186aa16e4 0x1869870dc 0x100c756b8 0x10108149c 0x10108145c 0x101086050 0x186a43f20 0x186a41afc 0x1869622d8 0x1887f3f84 0x18ff0f880 0x100c74204 0x18648656c) libc++abi.dylib: terminating with uncaught exception of type NSException

No0ne commented 6 years ago

https://github.com/chariotsolutions/phonegap-nfc/pull/288/files