iOS development can not be unaware of the dynamic fix bug patches third-party library jspatch Use learning: Jspatch import, and use,. js file transfer plus decryption

Source: Internet
Author: User

Jspatch

iOS development can not be unaware of the dynamic fix bug patches third-party library jspatch Use learning: Jspatch import, and use,. js file transfer plus decryption

iOS development is faced with a long audit cycle, fixed bug delay and other frustrating problems, so, the emergence of hot repair become inevitable.

iOS online app generates bugs, needs to be fixed in time, how to fix:

I have compiled the instructions for using Jspatch and set up a simple demo for others to use and learn, this blog does not do a detailed introduction, how to use the attached code address:

Code: Https://github.com/niexiaobo/JSPatchUse

##### demo.js Add code: 1, rewrite Crashbtnclick Method 2, jump new Jptableviewcontroller Controller

    1, modify the Viewcontroller controller Handlebtn method (the original controller leakage of this method, will cause a crash). DefineClass (' Viewcontroller ', {//defineclass: Declares the controller to be modified Crashbtnclick:function (sender) {//Declares the method to be modified or overridden Var Tablevi Ewctrl = Jptableviewcontroller.alloc (). Init () Self.navigationcontroller (). pushviewcontroller_animated ( Tableviewctrl, YES)},})//2, New Jptableviewcontroller controller defineclass (' Jptableviewcontroller:uitableviewcontr    Oller <UIAlertViewDelegate> ', [' data '], {datasource:function () {var data = Self.data ();    if (data) return data;    var data = [];    for (var i = 0; i <; i + +) {Data.push ("cell created by JS" + i);    } self.setdata (data) return data;    }, Numberofsectionsintableview:function (TableView) {return 1;    }, Tableview_numberofrowsinsection:function (TableView, section) {return Self.datasource (). length; }, Tableview_cellforrowatindexpath:function (TableView, indexpath) {var cell = Tableview.dequeuereusablecellwithide Ntifier ("cell") if (!cell) {cell = require (' UITableViewCell '). Alloc (). Initwithstyle_reuseidentifier (0, "cell")} Cell.textlabel (). SetText (S Elf.datasource () [Indexpath.row ()]) return cell}, Tableview_heightforrowatindexpath:function (TableView, Indexpat h) {return, tableview_didselectrowatindexpath:function (TableView, Indexpath) {var Alertview = require ( ' Uialertview '). Alloc (). Initwithtitle_message_delegate_cancelbuttontitle_otherbuttontitles ("Alert",    Self.datasource () [Indexpath.row ()], self, "OK", null); Alertview.show ()}, Alertview_willdismisswithbuttonindex:function (Alertview, idx) {console.log (' click btn ' + A Lertview.buttontitleatindex (IDX). TOJS ())}) ##### Update frequency

iOS development can not be known to dynamically fix bug patches third-party library jspatch Use learning: Jspatch import, and use,. js file transfer plus decryption

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.