Live data from Hacker News

Apple allows hot code push for JS downloaded and run by WebKit

meteor.com

21–30 of 74 posts

Re: Apple allows hot code push for JS downloaded and run by WebKit

#21
post #16

Many games are constantly downloading multi-megabyte "updates". I bet some of that stuff is Lua.

No, they catch that kind of stuff in app review. Lua code updates would be a small part of that. They're asset and IAP content, that is why it's multi-megabyte. It comes from experience.

Can they? For instance in love2d the mechanism for distributing a blob of assets after the fact is the same as the mechanism for distributing a blob of code after the fact. I'm not sure I can rewrite my app to be incapable of loading code from mounted archives, though I could rewrite it to not mount any archives until it's done loading code.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#22
post #14

This doesn't come as news to me. Every website can be shown via WK/UIWebViews as a "mobile app". Each javascript therefore is "hot code" being pushed. But I don't think Apple ever disallowed that, on the contrary it was the only way to develop for iPhone 1.

[i work at meteor]

After we announced 0.9.2 and hot code push for mobile apps, many of our users wanted to be sure it was kosher. It's easy to get confused about this because the App Store review guidelines suggest that downloading code isn't okay. And many Meteor developers don't have a deep background in the iOS ecosystem. The cool part about 0.9.2 is you can build mobile apps with just your basic Meteor/JS/HTML5 knowledge.

Apple's formal developer agreement is both controlling and clarifying, and since it's a bit harder to find we thought it would be good to point Meteor developers at the key part.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#23
post #19
post #17

Ultimate linkbait title for HN

I don't see it? In cases of misleading or linkbait titles we're glad to hear suggestions for a better title. There are too many posts here for us to correct everything correctly, so help is welcome.

While the title isn't necessarily false, it's misleading link bait because people click on it thinking that Apple is now allowing us to push out Swift/Objective-C updates in-app. It's more feasible than ever that this could happen now since they've added the ability to include frameworks inside of your apps where previously you couldn't.

The link is referring to using HTML/JS/CSS to update apps, which has been possible since the UIWebView in 2.0 - literally for years and years. You download those files and view them in a web view – technically it's running javascript "hot code" but this isn't news, it's been around since we could develop apps for iOS. A better title might be "Apple allows you to download and view HTML in a web browser inside of your app" but that wouldn't generate many clicks.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#24
post #2

This is probably the only feature that gives hybrid apps an actual upper-hand vs their native counterparts. So now I could instantly push an update to my apps by hot-swapping the js code, while a native version would be stuck in a a multi-day approval process. I can imaging there are some scenarios where getting a feature to market before a competitor would make this feature really valuable. One question, it specific…

> One question, it specifically mentions using the WebKit framework, does that mean that this is not allowed under the old UIWebView class?

This is nothing new. We have been using UIWebView to download JS code in our App Store apps since iOS 3. You can use UIWebView or WKWebView. I don't understand why this is on the front page of HN except that someone over at Meteor is doing a good job at drawing attention to their framework.

edit: I do understand that App Store rules can be confusing and Meteor may need to have this PSA to ensure their developers feel comfortable using their framework. But ultimately it's still nothing new, not news, and probably doesn't belong the HN front page – I'm sure I wasn't the only one who clicked the link thinking it was for native apps only to be disappointed.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#25
post #18

Earlier quoted context omitted.

Wow, thanks, I can't believe I missed reading about this until now. This framework looks really promising

The only reason it wasn't allowed until now was security. With iOS 8 cross process communication improvements, the JITed JavaScript engine can be used by third party apps in a segregated fashion without sacrificing security.

Is this also true when using JavaScriptCore directly? Or do you only get JIT compilation in the context of a web view?

Re: Apple allows hot code push for JS downloaded and run by WebKit

#26
post #19
post #17

Ultimate linkbait title for HN

I don't see it? In cases of misleading or linkbait titles we're glad to hear suggestions for a better title. There are too many posts here for us to correct everything correctly, so help is welcome.

Better title suggestion: Apple allows sites to be opened in webview

Re: Apple allows hot code push for JS downloaded and run by WebKit

#27

Earlier quoted context omitted.

No. In iOS 8 apps can use WKWebView, which is accelerated.

Wow, thanks, I can't believe I missed reading about this until now. This framework looks really promising

Unfortunately, due to sandboxing rules added around beta4, WKWebView doesn't allow access to any local files, making it nearly worthless for hybrid apps, ebook viewers, etc.

The only workaround that I know of is to run a webserver on a background thread and point the WKWebView at it. Hopefully Apple fixes this in a future release.

Also, WKWebView doesn't work with NSURLProtocol, which a lot of companies use to implement encryption and dynamic (e.g. database-sourced) web pages.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#28
post #18

Earlier quoted context omitted.

The only reason it wasn't allowed until now was security. With iOS 8 cross process communication improvements, the JITed JavaScript engine can be used by third party apps in a segregated fashion without sacrificing security.

Is this also true when using JavaScriptCore directly? Or do you only get JIT compilation in the context of a web view?

Only in a web view. The point is that the JITed code is in an isolated process with few permissions.

Re: Apple allows hot code push for JS downloaded and run by WebKit

#29
post #19

Earlier quoted context omitted.

I don't see it? In cases of misleading or linkbait titles we're glad to hear suggestions for a better title. There are too many posts here for us to correct everything correctly, so help is welcome.

While the title isn't necessarily false, it's misleading link bait because people click on it thinking that Apple is now allowing us to push out Swift/Objective-C updates in-app. It's more feasible than ever that this could happen now since they've added the ability to include frameworks inside of your apps where previously you couldn't. The link is referring to using HTML/JS/CSS to update apps, which has been possib…

Yeah, I found the title misleading, too.

What is news to me is the explicit mention of WebViews. I remember this exception previously being for JavaScript in general, which I assume would include JavaScriptCore.

Does anyone know if they changed this before or after JavaScriptCore was introduced?

Post reply on HN