IOS Program plugin and function Dynamic update idea

Source: Internet
Author: User
Tags lua
Frame and Language iOS client-wax (development of Angry Birds connecting Lua and OBJC frames), LUA,OBJC, server-side-java (for return plugin page) tool frame link address: wax-https://github.com/ Probablycorey/wax netty-https://netty.io/used as an HTTP server, the return page because of the LUA scripting language, does not need to compile to run, this is my idea can carry out the premise, plus the apple allows the feet like Lua The existence of this, this idea can be realized. The idea of personal feeling is somewhat similar to a programming application on the ipad Codea,codea allows us to use LUA to program the ipad, to write games.
Text: 1. Call Wax_start ("Init.lua", nil) in the iOS program, this Init.lua is the beginning of our plugin, like the class of program main function, the starting point of the Lua script. 2. Reserve the Function button in the program to request the server to obtain the list of Plug-ins, after the selection list can be this corresponding Lua script (Testcontroller.lua) to the client, so that we have a client of the equivalent of a OBJC-class file,         Unlike OBJC, this class does not need to be compiled and is now ready to run. 3. What we have to do at the client is to save our list of Plug-ins and the path we are in so that the program knows where to find the corresponding Lua script to execute. The idea is very simple, do not know oneself to say clearly not, below I put the example that oneself writes come up, communicate with everybody
Service-side program, click Httpstaticfileserver to start the server, this program is a netty example, in this enough to use, unmodified, Testcontroller.lua is the service side to return to the client script. Client programs, primarily Rootviewcontroller, that interact with LUA and set the server's address and corresponding ports in this class

The operation effect of the program is as follows:


Sample program Download path: http://download.csdn.net/detail/wssand44/4878972

http://download.csdn.net/detail/wssand44/6740495 (Python for service, version one, server easy to deploy)

Because the Apple sandbox mechanism, our program can not be installed after the access to the resource bundle directory, so the framework downloaded from the official website can not be applied to the actual application, we need to modify the following methods in the WAX.M, modified as follows
void Wax_setup () {
Nssetuncaughtexceptionhandler (&uncaughtexceptionhandler);

Nsfilemanager *filemanager = [Nsfilemanager Defaultmanager];
[FileManager Changecurrentdirectorypath:[[nsbundle Mainbundle] Bundlepath]];

[FileManager changecurrentdirectorypath:[nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES) objectatindex:0]];

Lua_state *l = Wax_currentluastate ();
Lua_atpanic (L, &wax_panic);

Lual_openlibs (L);


Luaopen_wax_class (L);
Luaopen_wax_instance (L);
Luaopen_wax_struct (L);

Addglobals (L);

[WAX_GC start];
}


Then recompile the framework and import it into our program.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.