Personal Summary of hot update and Hotfix, and summary of hot update and repair

Source: Internet
Author: User

Personal Summary of hot update and Hotfix, and summary of hot update and repair

Hotfix and hotupdate

1. Hot update and Hotfix: Online BUG fixes

2. How JSPach works: OC is a language for dynamic runtime, and method runtime and object creation are created during runtime. JSPatch uses JavaScriptCore. as a JS engine, framework dynamically calls methods and objects from JS to OC, and then uses NSInvocation to dynamically call corresponding methods. example

Class class = NSClassFromString (@ "UIViewController ");

Id controller = [class new];

SEL selector = NSSelectorFromString (@ "viewDidLoad ");

[Controller extends mselector: selector];

3 Procedure

Drag the JSPatch folder to the file and drag the dome. js file downloaded from gitHub to the project. In APPDelegate:

# Import "AppDelegate. h"

# Import "JPEngine. h"

# Import "ViewController. h"

 

@ Interface AppDelegate ()

 

@ End

 

@ Implementation AppDelegate

 

-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( 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,100, [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 {

 

}

Change JSViewController in dome. js to ViewController.

 

React Native

Literacy

Note

Use this article to write a good link: https://zhuanlan.zhihu.com/p/19996445

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.