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