Closed peterkrieg closed 6 years ago
Hello,
using tns-ios 3.4.1, on Mac OS I'm having the following error: JS ERROR TypeError: this.webView.ios.stringByEvaluatingJavaScriptFromString is not a function.
3.4.1
JS ERROR TypeError: this.webView.ios.stringByEvaluatingJavaScriptFromString is not a function.
I created a repo of minimal code to quickly see this issue: https://github.com/peterkrieg/nativescript-webview-interface-test. You just have to clone the repo and run tns run ios to see the error.
tns run ios
Full error copied below:
Native stack trace: 1 0x1093b978b NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*) 2 0x109a5d10e ffi_closure_unix64_inner 3 0x109a5da52 ffi_closure_unix64 4 0x11d538258 WebKit::WebPageProxy::decidePolicyForNavigationAction(unsigned long long, WebKit::SecurityOriginData const&, unsigned long long, WebKit::NavigationActionData const&, unsigned long long, WebKit::SecurityOriginData const&, WebCore::ResourceRequest const&, WebCore::ResourceRequest const&, unsigned long long, WebKit::UserData const&, bool&, unsigned long long&, unsigned long long&, unsigned long long&) 5 0x11d55df1d void IPC::callMemberFunctionImpl<WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long long, WebKit::SecurityOriginData const&, unsigned long long, WebKit::NavigationActionData const&, unsigned long long, WebKit::SecurityOriginData const&, WebCore::ResourceRequest const&, WebCore::ResourceRequest const&, unsigned long long, WebKit::UserData const&, bool&, unsigned long long&, unsigned long long&, unsigned long long&), std::__1::tuple<unsigned long long, WebKit::SecurityOriginData, unsigned long long, WebKit::NavigationActionData, unsigned long long, WebKit::SecurityOriginData, WebCore::ResourceRequest, WebCore::ResourceRequest, unsigned long long, WebKit::UserData>, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul, std::__1::tuple<bool, unsigned long long, unsigned long long, unsigned long long>, 0ul, 1ul, 2ul, 3ul>(WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(unsigned long long, WebKit::SecurityOriginData const&, unsigned long long, WebKit::NavigationActionData const&, unsigned long long, WebKit::SecurityOriginData const&, WebCore::ResourceRequest const&, WebCore::ResourceRequest const&, unsigned long long, WebKit::UserData const&, bool&, unsigned long long&, unsigned long long&, unsigned long long&), std::__1::tuple<unsigned long long, WebKit::SecurityOriginData, unsigned long long, WebKit::NavigationActionData, unsigned long long, WebKit::SecurityOriginData, WebCore::ResourceRequest, WebCore::ResourceRequest, unsigned long long, WebKit::UserData>&&, std::__1::tuple<bool, unsigned long long, unsigned long long, unsigned long long>&, std::index_sequence<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul, 8ul, 9ul>, std::index_sequence<0ul, 1ul, 2ul, 3ul>) 6 0x11d559eb6 void IPC::handleMessage<Messages::WebPageProxy::DecidePolicyForNavigationAction, WebKit::WebPageProxy, void (WebKit::WebPageProxy::*)(unsigned long long, WebKit::SecurityOriginData const&, unsigned long long, WebKit::NavigationActionData const&, unsigned long long, WebKit::SecurityOriginData const&, WebCore::ResourceRequest const&, WebCore::ResourceRequest const&, unsigned long long, WebKit::UserData const&, bool&, unsigned long long&, unsigned long long&, unsigned long long&)>(IPC::MessageDecoder&, IPC::MessageEncoder&, WebKit::WebPageProxy*, void (WebKit::WebPageProxy::*)(unsigned long long, WebKit::SecurityOriginData const&, unsigned long long, WebKit::NavigationActionData const&, unsigned long long, WebKit::SecurityOriginData const&, WebCore::ResourceRequest const&, WebCore::ResourceRequest const&, unsigned long long, WebKit::UserData const&, bool&, unsigned long long&, unsigned long long&, unsigned long long&)) 7 0x11d407d64 IPC::MessageReceiverMap::dispatchSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::__1::unique_ptr<IPC::MessageEncoder, std::__1::default_delete<IPC::MessageEncoder> >&) 8 0x11d58a2f8 WebKit::WebProcessProxy::didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::__1::unique_ptr<IPC::MessageEncoder, std::__1::default_delete<IPC::MessageEncoder> >&) 9 0x11d3c7f08 IPC::Connection::dispatchSyncMessage(IPC::MessageDecoder&) 10 0x11d3c5d67 IPC::Connection::dispatchMessage(std::__1::unique_ptr<IPC::MessageDecoder, std::__1::default_delete<IPC::MessageDecoder> >) 11 0x11d3c803e IPC::Connection::dispatchOneMessage() 12 0x113bd6635 WTF::RunLoop::performWork() 13 0x113bd6d12 WTF::RunLoop::performWork(void*) 14 0x10cc92301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 15 0x10cc8822c __CFRunLoopDoSources0 16 0x10cc876e3 __CFRunLoopRun 17 0x10cc870f8 CFRunLoopRunSpecific 18 0x10e241ad2 GSEventRunModal 19 0x10a500f09 UIApplicationMain 20 0x109a5d8ad ffi_call_unix64 21 0x1205594f0 JavaScript stack trace: 1 _executeJS@file:///app/tns_modules/nativescript-webview-interface/index.js:50:71 2 _interceptCallsFromWebview@file:///app/tns_modules/nativescript-webview-interface/index.js:33:43 3 notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:100:37 4 _onLoadStarted@file:///app/tns_modules/tns-core-modules/ui/web-view/web-view-common.js:35:20 5 webViewDecidePolicyForNavigationActionDecisionHandler@file:///app/tns_modules/tns-core-modules/ui/web-view/web-view.js:43:33 6 UIApplicationMain@[native code] 7 start@file:///app/tns_modules/tns-core-modules/application/application.js:235:26 8 bootstrapApp@file:///app/tns_modules/nativescript-angular/platform-common.js:86:28 9 bootstrapModule@file:///app/tns_modules/nativescript-angular/platform-common.js:72:26 10 anonymous@file:///app/main.js:10:57 11 evaluate@[native code] 12 moduleEvaluation@[native code] 13 @[native code] 14 promiseReactionJob@[native code] JavaScript error: file:///app/tns_modules/nativescript-webview-interface/index.js:50:71: JS ERROR TypeError: this.webView.ios.stringByEvaluatingJavaScriptFromString is not a function. (In 'this.webView.ios.stringByEvaluatingJavaScriptFromString(strJSFunction)', 'this.webView.ios.stringByEvaluatingJavaScriptFromString' is undefined)
I see this is already discussed in #22, PR #24 works great and fixes this.
Closing this issue as PR #24 is merged and published with version 1.4.2.
Hello,
using tns-ios
3.4.1
, on Mac OS I'm having the following error:JS ERROR TypeError: this.webView.ios.stringByEvaluatingJavaScriptFromString is not a function.
I created a repo of minimal code to quickly see this issue: https://github.com/peterkrieg/nativescript-webview-interface-test. You just have to clone the repo and run
tns run ios
to see the error.Full error copied below: