Closed manuelfrey closed 4 years ago
Hi @Manu-F, as far as I can see you are trying to directly access a C++ class (MyNative
) from JavaScript. NativeScript's iOS bridge, however, supports only Objective-C. In order to call your native methods, you have to wrap them in Objective-C @interface
s. I hope this sheds light on the issue, if you need any other directions, feel free to ask.
I recommend examining the iOS runtime documentation: https://docs.nativescript.org/core-concepts/ios-runtime/Overview
Hi @mbektchiev, thanks a lot for your fast response and this hint. You're right. I made the mistake that I just put the c++ - header file in the objective-c umbrella header. After I made a real objective-c class and wrapped the c++ class it works. 👍 And thank you very much for your offer to response to further questions. Perfect! :-)
At the moment I have a problem which looks similar to https://github.com/NativeScript/ios-runtime/issues/1061. But the described workaround is failing in my solution.
My scenario: I would like to create a NativeScript Plugin. The Plugin should contain an objective C clas which wraps a c++ class. For testing purpose it is just a simple getnumber method ehich return a simple number an other method returns a string. I am using NativeScript 6.1.2.
I tried the following:
1.) I built an 'fat' dynamic framework with XCode and an objective C clas, The check with lipo returns the following info:
Architectures in the fat file: test3 are: x86_64 i386 armv7 armv7s arm64
2.) I included it in my Nativescript plugin and started the demo app
3.) In My demo app I always got the error message:
"Metadata for 'test3.MyNatuve' found but symbol not available at runtime."
4.) I searched with google and found the issue 'https://github.com/NativeScript/ios-runtime/issues/1061' and tried to solve it in the same way
I called the following command
nm --defined-only test3 | grep " T " | cut -f 3 -d' ' | egrep -v '^$|test3' > test3_defined
The content looks like:
...and extendend the buildxconfig with the folloing lines:
(The path must be correct, if I change it I got an error message withw rong path)
5.) I can rebuild and run the demo app without errors. But if I call the function I got the error again: "Metadata for 'test3.MyNatuve' found but symbol not available at runtime."
I don't have any ideas any more to solve this problem or just to find further informations.
Thanks in advance for any hints or assistance.