IOS program plug-in and function dynamic update ideas

Source: Internet
Author: User

    1. Used framework and Language iOS client-wax (Develop Angry Birds connection Lua and OBJC framework), LUA,OBJC, Server-java (for return plugin page)
    2. Tool Frame link Address: wax-https://github.com/probablycorey/wax netty-https://netty.io/used as an HTTP server, return to page
Since the LUA scripting language does not need to be compiled to run, this is the premise that my idea can be implemented, plus the idea that Apple allows scripts like LUA to be implemented. Personal feeling the idea is a bit like a programming app on the ipad Codea,codea allows us to use LUA to program and write games on the ipad. Body: 1. Call Wax_start inside the iOS program ("Init.lua",NilThis Init.lua is the starting point of our plugin's first class, similar to the program main function, of the Lua script. 2. Reserve the Function button in the program request the server to get a list of plug-ins, after selecting the list can be the corresponding Lua script (Testcontroller.lua) download to the client, so that our client has a similar to the OBJC class of files,        Unlike OBJC, this class does not need to be compiled and is now ready to run. 3. What we have to do on the client side is to save our list of plugins and the path we have, so the program knows where to find the appropriate LUA script to execute. The idea is very simple, do not know oneself to say clearly no, below I put oneself to write the example paste up, communicate with everybodyService side of the program, click Httpstaticfileserver Start the server, this program is Netty example, in this is enough, not modified, Testcontroller.lua is the service side to return to the client script. The client program, primarily in Rootviewcontroller, interacts with LUA, setting the server's address in this class and the corresponding port program running as follows: Sample program Download path: http://download.csdn.net/detail/wssand44/ 4878972 http://download.csdn.net/detail/wssand44/6740495 (Python for service end, version one, server easy to deploy)because of the Apple sandbox mechanism, our program can not be installed after access to the resource pack directory, so the framework downloaded from the official website can not be applied to the actual application, we need to modify the WAX.M in the following methods, 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 into our program. Ext.: http://blog.csdn.net/wssand44/article/details/8288178
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.