<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          JSPatchiOS App 熱更新服務(wù)平臺

          聯(lián)合創(chuàng)作 · 2023-09-27 13:48

          JSPatch 可以讓你用 JavaScript 書寫原生 iOS APP。只需在項目引入極小的引擎,就可以使用 JavaScript 調(diào)用任何 Objective-C 的原生接口,獲得腳本語言的優(yōu)勢:為項目動態(tài)添加模塊,或替換項目原生代碼動態(tài)修復(fù) bug。

          例如線上 APP 有一段代碼出現(xiàn) bug 導(dǎo)致 crash:

          @implementation JPTableViewController
          ...
          - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
          {
            NSString *content = self.dataSource[[indexPath row]];  //可能會超出數(shù)組范圍導(dǎo)致crash
            JPViewController *ctrl = [[JPViewController alloc] initWithContent:content];
            [self.navigationController pushViewController:ctrl];
          }
          ...
          @end

          可以通過下發(fā)這樣一段 JS 代碼,覆蓋掉原方法,修復(fù)這個 bug:

          //JS
          defineClass("JPTableViewController", {
            //instance method definitions
            tableView_didSelectRowAtIndexPath: function(tableView, indexPath) {
              var row = indexPath.row()
              if (self.dataSource().length > row) {  //加上判斷越界的邏輯
                var content = self.dataArr()[row];
                var ctrl = JPViewController.alloc().initWithContent(content);
                self.navigationController().pushViewController(ctrl);
              }
            }
          }, {})

          除了修復(fù) bug,JSPatch 也可以用于動態(tài)運營,實時修改線上 APP 行為,或動態(tài)添加功能。

          瀏覽 13
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  五月婷婷网站 | 青青操视频在线观看无码 | 日本黄色视频免费看 | 成人网址一区二区三区 | 黄片免费观看永久免费 |