Hacker News new | ask | show | jobs
by nglevin 4777 days ago
Functionally, this appears to be identical to JavaScriptCore's longstanding C bridge [1]. If Objective-C isn't your preference, there's nothing stopping you from calling into the C bridge from C++ or just plain C.

On iOS, developers have had to compile their own version of JavaScriptCore to use this API. That's the basis for HTML5 game engines like Impact [2], and some HTML5-to-Objective-C middleware platforms.

Unfortunately, until Apple says otherwise, this version of JSC is still subject to Apple's App Store review guidelines [3]. Thanks to guideline 2.8, you can't have your app, running JSC, execute any JavaScript that doesn't ship within the bundle of your app.

I'd like to see that rule change, someday. Exposing this Objective-C API in a future iOS release isn't going to change the status quo.

[1] - http://developer.apple.com/library/mac/#documentation/Carbon...

[2] - http://impactjs.com

[3] - https://developer.apple.com/appstore/guidelines.html

2 comments

All good points. The big difference with the bridge going to Objective-C, though, is that I believe it is now possible to build a native UI by calling right from JavaScript to Objective-C. Impact is interesting for games and canvas-like rendering, but what I'd love is to be able to build the models and controllers of a highly performant, native-UI iOS app using JavaScript and UIKit. Sort of like Appcelerator with a layer removed.
That's fair. This does save one ugly, extra step that I didn't mention, which would be to call into the Objective-C runtime's C API [1] to dispatch messages and introspect Objective-C classes.

Should make it easier for developers to build their own middleware platform without getting too deep into reams of C boilerplate.

[1] - https://developer.apple.com/library/ios/#documentation/Cocoa...

You should be able to to run code downloaded as part of IAP also. But this is one of the major things I wish they would change, and also one of the major reasons I'll be switching to Android.
Which is what I meant by "within the bundle of your app." That may have been a bit too iOS developer-centric, I apologize.

In Foundation, [NSBundle mainBundle] returns a reference to an object representing your application's root directory, and the code and resources found within. Roughly the same bits that you'd find within an unpacked IAP file.