使用JSPatch实现iOS客户端热更新
2017-01-16 本文已影响100人
否极泰来_L
首先没有JSPatch帐号的去官网注册帐号JSPatch 注册入口(可以使用fir.im帐号直接登录)。
集成sdk按照文档来就行,很简单。
登录完成后点击新增APP,填写App名称和AppID(没上线可不填)

添加完成后点击管理,点击添加APP版本,填写当前的版本号

点击App版本进入发布补丁页,提交补丁

js示例1 ---- 覆盖类方法的实现
require("UIAlertView");
defineClass("JSPatchViewController", {
modifyButtonClick: function() {
var alertView = UIAlertView.alloc().initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles("使用JSPatch修改了类方法", null, null, "确定", null, null);
alertView.show();
}
}, {});
js示例2 ---- 添加未定义的方法
defineClass("JSPatchViewController", {
addButtonClick: function() {
var alertView = UIAlertView.alloc().initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles("使用JSPatch添加未定义的方法后打印出来的结果", null, null, "确定", null, null);
alertView.show();
}
});
还有很多热更新的方法,大家可以自己去看一下
