12

Can I use V8 on iOS? If not, which embeddable JavaScript engine do you recommend?

EDIT:

We don't plan on using it in conjunction with HTML rendering, just for internal scripting.

Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
  • 3
    Dupe of: http://stackoverflow.com/questions/5317776/embed-javascript-engine-in-ios-application – Shaz Apr 23 '11 at 13:56
  • There's a somewhat recent (2013 August) effort to adapt the V8 source to iOS: https://github.com/nguyenduong/V8-iOS – namuol Aug 16 '13 at 00:06

1 Answers1

1

Apple requires that you use WebKit when rendering web-content in an app, and they may reject your app if you use something else.

That said, you may want JavaScript for something other than rendering a webpage, and in theory that use-case should allow you to use whatever JavaScript engine you want. As the V8 source-code is available in C++, it should be possible to compile it into an iOS project. To do so you'll need to rename any .m files that make use of V8 functionality (either directly or indirectly through transitive dependencies) to .mm so that XCode knows to compile those files as Objective-C++.

This process of getting it to work will likely be a bit finicky, but in theory it should be possible.

aroth
  • 54,026
  • 20
  • 135
  • 176
  • 8
    V8 is c++ **and an assembler**. C++ is fairly portable, the assembler and code generation are *very* architecture specific. To me that is the biggest question about V8 on the iOS platform. – deft_code Jun 20 '11 at 00:30