IJSExport Missing from OSX SDKs?

Trying to create an interface that inherits from JSExport on OSX. Following along with this example for Objective-C.

 interface SampleBridgeJSExport: IJSExport // Fire says Unknown Type

When I ack JSExport in Fire.app/Contents/Resources four results come up but they’re all under iOS 7.1.

Doesn’t seem like the OSX SDK’s have a definition for this interface. Although I do see a reference to JSExport.h in 10.11/JavaScriptCore.fx. Are there any work-arounds for this?

Sounds like a bug in the import, we’ll need to look into that. I can’t think of an obvious workaround right now, sorry.

Thanks, logged as bugs://72602

That said, this looks liken empty protocol though? i see only this in JSExport.h:

@protocol JSExport
@end

so while i agree it should be imported, do you really need it?

Doing a quick code search for JSExport in the WebKit repo it looks like it’s used in a fair bit of places. At this point in my journey I’m still in the “trying to get the basics working” phase so I’m lacking the experience of using these components well enough to know how all these pieces fit together to make the JavaScriptCore bridge work.

I was trying the same thing with Xamarin and although I got the JSExport functionality working it appears there are some bugs in their JSValue implementation so I didn’t get that far there either. I have managed to get a proof of concept working in Swift and Objective-C though…

as a workaround, can you just declare it as empty interface in your project? assuming you just need to for the ancestry as not to have to manually remove in in dozens of places…

bugs://72605 got closed with status fixed.

bugs://72602 got closed with status fixed.

The compile errors are now gone and I’m able to access an instance of NSObject from JavaScript. However the instance does not contain the methods that were defined in the interface and implemented in the class. It’s just a blank object…

Latest code is here.

hi, sorry for the late reply, i missed the followup,
we’re looking into this, looks like its some missing metadata.

Thanks, logged as bugs://73337

bugs://73337 got closed with status fixed.

Works for the next beta build (next week, mail me if you need this sooner).

Note that your testcase has some flaws, like the array it passes should be wrapped in another array in the callback.

David,

i’ve uploaded a new build to http://downloads.remobjects.com/personal. Please let me know if this fixes the issue for you.

yours,
marc

I installed the update in my Windows Virtual Machine and setup Crossbox. Unfortunately the methods were still not showing up on the JavaScript object.

Thanks again for continuing to troubleshoot this!

ah I almost forgot: make the class you have for the javascript implementation publc.

That was it! It’s working now!

Thank you!!

1 Like