ios Terms and scripting languages
i was looking at several lua/objective-c implementations that looked promising for a project i want to create ,but with an exception that i wanted to be able to download the scripts at runtime.Then i found the terms which state :
"An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple's built-in WebKit framework."
so clearly you cant download any lua scripts at runtime. If i interpret correctly you can only run javascript files downloaded through UIWebView. So if i wanted to create a objective-c/javascript bridge through uiwebkit(with stringByEvaluatingJavaScriptFromString and url encodings) ,i dont see anything against apple's term right?do you thin开发者_如何学Ck it would be an overkill in perfomance?
I have no experience about the performance of executing Javascript through UIWebView
, but I suspect the toll is high if you plan to call stringByEvaluatingJavaScriptFromString
with fine grained code. On the other hand, nothing keeps you from loading a full HTML in your UIWebView
with all the Javascript code that you need, and this approach would certainly ensure better performance.
actually, there is an alternative approach that you can try and follow. It is actually possible to directly embed the WebKit Javascript Engine (Javascript Core) into your app. This approach has already been "approved" by Apple and you can find it described here. (Dominic Szablewski, the creator of the JavaScript game engine Impact, is the guy who accomplished this).
In short, it comes down to compile the Javascript Core as a static library and then link this in your app. If you don't feel like compiling it yourself, at the link I posted you can also find more information as to how you can license the library from Dominic Szablewski. (I am not really suggesting anything at this respect, just summarizing information).
精彩评论