1

Does PhoneGap just use UIWebVIew or is it doing something more then that?

Can it take advantage of Apples Nitro VM?

I'm currently exploring the choices for porting our javascript app to native. I'm researching PhoneGap and Titanium, trying to figure out how they differ.

Thanks for any insight.

fancy
  • 48,619
  • 62
  • 153
  • 231

3 Answers3

5

Yes PhoneGap uses a UIWebView but it is highly customized with lots of custom javascript which gets injected into the page.

No as it uses a UIWebView it doesn't gets to use the NITRO javascript engine.

Edit: Apple corrected the fullscreen web apps bug however they did not fix it for UIWebViews as that would let normal apps mark memory chunks as executable (security risk).

Kyle Howells
  • 3,008
  • 1
  • 25
  • 35
  • Thanks! Have you worked with Titanium at all, is it doing the same thing? – fancy Aug 06 '11 at 11:51
  • @oolong Yes I tried out Titanium briefly. No Titanium is not using a UIWebView, Titanium doesn't even use the code you give it. It converts/compiles your js code into Objective-C & then lets Xcode compile that Objective-C into fully native arm code. – Kyle Howells Aug 06 '11 at 12:54
  • @oolong With PhoneGap you write a WebApp which has access to some native features through javascript. With Titanium you write a native app using javascript rather then obj-c. – Kyle Howells Aug 06 '11 at 12:55
  • Find me some documentation to the contrary, but I have found no evidence that UIWebViews in applications make use of Nitro. http://www.quora.com/iOS-5/Did-UIWebView-in-iOS-5-get-the-Nitro-JavaScript-engine – jamie Dec 13 '11 at 09:05
  • @jamie yes sorry, apple fixed the bug where full screen web apps didn't use it. However they can't enable it for UIWebViews without either creating a big security risk or splitting Javascript rendering into a separate process. – Kyle Howells Dec 13 '11 at 13:03
  • So that would be "No, it does not use Nitro" then. – jamie Dec 14 '11 at 07:48
  • i pray nitro lands on webviews in ios6...not holding my breath tho. – sic1 Jun 14 '12 at 23:07
  • Freerunnering - just to amend the record, Titanium doesn't compile your code into Objective-C. Instead it runs the built in javascript engine (outside of UIWebView), and has an interface from the JS to Objective-C modules. See http://developer.appcelerator.com/blog/2012/05/comparing-titanium-and-phonegap.html – Dan Smart Jun 29 '12 at 08:09
  • It seems like there's a way to enable Nitro by changing the application entitlements in XCode. See [link](www.littlereddoor.co.uk/ios/how-to-enable-the-nitro-javascript-engine-in-ios-applications-directly-through-xcode/) – Alon Burg Nov 30 '12 at 23:10
0

In Titanium, app code is written in core JavaScript and it spits native code while compilation using language bridge. So Titanium is completely native.

PhoneGap is nothing but just a UIWebView.

ducktyped
  • 4,354
  • 4
  • 26
  • 38
0

I would like to know too. I have found no evidence that Nitro is enabled in UIWebView. There is plenty of evidence that it was not enabled in 4.3 (it was only in Safari itself). There are reports that it was enabled in other Apps beyond Safari in 5.0, but I can find no evidence that it is enabled in UIWebView.

From CNET referencing the HN discussion:

"There's also a way to create Web apps on iOS that doesn't use Safari proper, an interface called UIWebView.

That doesn't look to be getting the Nitro speed-up for security reasons involving just-in-time (JIT) compilation that Nitro uses to create faster versions of JavaScript software on the fly."

More reading:

jamie
  • 2,963
  • 1
  • 26
  • 27