Personal summary of heat update and heat recovery

Source: Internet
Author: User

Hot Fixes and hot updates

1 hot update and hot fix: BUG of online fix program

2 Jspach Use principle: OC is a dynamic runtime language, the operation of methods and the creation of objects are created in the runtime. Jspatch is using the runtime, the javascriptcore.framework as the JS engine, from the JS dynamic call method and object to OC, then function nsinvocation dynamic call corresponding method.

Class class = Nsclassfromstring (@ "Uiviewcontroller");

ID controller = [class new];

SEL selector = nsselectorfromstring (@ "Viewdidload");

[Controller Performselector:selector];

3 Use steps

Drag the Jspatch folder into the file and drag the Dome.js file downloaded from GitHub into the project, in Appdelegate:

#import "AppDelegate.h"

#import "JPEngine.h"

#import "ViewController.h"

@interface Appdelegate ()

@end

@implementation Appdelegate

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {

[Jpengine StartEngine];

NSString *jspath = [[NSBundle mainbundle] pathforresource:@ "Demo.js" oftype:nil];

[Jpengine Evaluatescriptwithpath:jspath];

Self.window = [[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds];

Viewcontroller *rootviewcontroller = [[Viewcontroller alloc] init];

Uinavigationcontroller *navigationcontroller = [[Uinavigationcontroller alloc] Initwithrootviewcontroller: Rootviewcontroller];

Self.window.rootViewController = Navigationcontroller;

[Self.window makekeyandvisible];

return YES;

}

@end

and implemented in VIEWCONTROLLER.M.

-(void) Viewdidload {

[Super Viewdidload];

UIButton *btn = [[UIButton alloc] Initwithframe:cgrectmake (0, + [UIScreen mainscreen].bounds.size.width, 50)];

[Btn settitle:@ "Push jptableviewcontroller" forstate:uicontrolstatenormal];

[Btn addtarget:self Action: @selector (HANDLEBTN:) forcontrolevents:uicontroleventtouchupinside];

[Btn Setbackgroundcolor:[uicolor Graycolor];

[Self.view ADDSUBVIEW:BTN];

}

-(void) HANDLEBTN: (UIButton *) btn {

}

Finally, change the Jsviewcontroller in Dome.js to Viewcontroller.

React Native

Literacy: is a technology that can simultaneously operate the front, back, and mobile to update the development in real time

Note: Create Javasript code by Javasript Runtime

The specific use of this article written very good link: https://zhuanlan.zhihu.com/p/19996445

Personal summary of heat update and heat recovery

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.