{"id":2107,"date":"2023-04-01T22:22:21","date_gmt":"2023-04-01T14:22:21","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=2107"},"modified":"2023-04-05T20:47:03","modified_gmt":"2023-04-05T12:47:03","slug":"ios-hotfix-framework-jspatch","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/04\/01\/ios-hotfix-framework-jspatch\/","title":{"rendered":"iOS\u70ed\u4fee\u590d\u6846\u67b6JSPatch"},"content":{"rendered":"<h2>\u4ec0\u4e48\u662f JSPatch<\/h2>\n<p>Github\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/bang590\/JSPatch\">https:\/\/github.com\/bang590\/JSPatch<\/a><\/p>\n<p><code>JSPatch<\/code>\u662f\u4e00\u4e2a\u5f00\u6e90\u9879\u76ee\uff0c\u53ea\u9700\u8981\u5728\u9879\u76ee\u91cc\u5f15\u5165\u6781\u5c0f\u7684\u5f15\u64ce\u6587\u4ef6\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528<code>JavaScript<\/code>\u8c03\u7528\u4efb\u4f55<code>Objective-C<\/code>\u7684\u539f\u751f\u63a5\u53e3\uff0c\u66ff\u6362\u4efb\u610f<code>Objective-C<\/code>\u539f\u751f\u65b9\u6cd5\u3002\u76ee\u524d\u4e3b\u8981\u7528\u4e8e\u4e0b\u53d1<code>JS<\/code>\u811a\u672c\u66ff\u6362\u539f\u751f<code>Objective-C<\/code>\u4ee3\u7801\uff0c\u5b9e\u65f6\u4fee\u590d\u7ebf\u4e0abug\u3002<\/p>\n<p><!-- more --><\/p>\n<p>\u4f8b\u5982\u7ebf\u4e0a APP \u6709\u4e00\u6bb5\u4ee3\u7801\u51fa\u73b0 bug \u5bfc\u81f4 crash\uff1a<\/p>\n<pre><code class=\"language-objective-C\">@implementation JPTableViewController\n...\n- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath\n{\n  NSString *content = self.dataSource[[indexPath row]];  \/\/\u53ef\u80fd\u4f1a\u8d85\u51fa\u6570\u7ec4\u8303\u56f4\u5bfc\u81f4crash\n  JPViewController *ctrl = [[JPViewController alloc] initWithContent:content];\n  [self.navigationController pushViewController:ctrl];\n}\n...\n@end<\/code><\/pre>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4e0b\u53d1\u8fd9\u6837\u4e00\u6bb5<code>JS<\/code>\u4ee3\u7801\uff0c\u8986\u76d6\u6389\u539f\u65b9\u6cd5\uff0c\u4fee\u590d\u8fd9\u4e2abug\uff1a<\/p>\n<pre><code class=\"language-javascript\">\/\/JS\ndefineClass(&quot;JPTableViewController&quot;, {\n  \/\/instance method definitions\n  tableView_didSelectRowAtIndexPath: function(tableView, indexPath) {\n    var row = indexPath.row()\n    if (self.dataSource().length &gt; row) {  \/\/\u52a0\u4e0a\u5224\u65ad\u8d8a\u754c\u7684\u903b\u8f91\n      var content = self.dataArr()[row];\n      var ctrl = JPViewController.alloc().initWithContent(content);\n      self.navigationController().pushViewController(ctrl);\n    }\n  }\n}, {})<\/code><\/pre>\n<p>\u9664\u4e86\u4fee\u590dbug\uff0c<code>JSPatch<\/code>\u4e5f\u53ef\u4ee5\u7528\u4e8e\u52a8\u6001\u8fd0\u8425\uff0c\u5b9e\u65f6\u4fee\u6539\u7ebf\u4e0aAPP\u884c\u4e3a\uff0c\u6216\u52a8\u6001\u6dfb\u52a0\u529f\u80fd\u3002JSPatch \u8be6\u7ec6\u4f7f\u7528\u6587\u6863\u89c1 <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/bang590\/JSPatch\/wiki\" title=\"Github Wiki\">Github Wiki<\/a>\u3002<\/p>\n<h2>\u4ec0\u4e48\u662f JSPatch \u5e73\u53f0<\/h2>\n<p>\u5b98\u7f51\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/jspatch.com\">https:\/\/jspatch.com<\/a><\/p>\n<p><code>JSPatch<\/code>\u9700\u8981\u4f7f\u7528\u8005\u6709\u4e00\u4e2a\u540e\u53f0\u53ef\u4ee5\u4e0b\u53d1\u548c\u7ba1\u7406\u811a\u672c\uff0c\u5e76\u4e14\u9700\u8981\u5904\u7406\u4f20\u8f93\u5b89\u5168\u7b49\u90e8\u7f72\u5de5\u4f5c\uff0c<code>JSPatch<\/code>\u5e73\u53f0\u5e2e\u4f60\u505a\u4e86\u8fd9\u4e9b\u4e8b\uff0c\u63d0\u4f9b\u4e86\u811a\u672c\u540e\u53f0\u6258\u7ba1\uff0c\u7248\u672c\u7ba1\u7406\uff0c\u4fdd\u8bc1\u4f20\u8f93\u5b89\u5168\u7b49\u529f\u80fd\uff0c\u8ba9\u4f60\u65e0\u9700\u642d\u5efa\u4e00\u4e2a\u540e\u53f0\uff0c\u65e0\u9700\u5173\u5fc3\u90e8\u7f72\u64cd\u4f5c\uff0c\u53ea\u9700\u5f15\u5165\u4e00\u4e2aSDK\u5373\u53ef\u7acb\u5373\u4f7f\u7528<code>JSPatch<\/code>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662f JSPatch Github\uff1ahttps:\/\/github.com\/bang590\/JSPatch J [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[533],"class_list":["post-2107","post","type-post","status-publish","format-standard","hentry","category-ios","tag-jspatch"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2107"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/2107\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}