{"id":13078,"date":"2023-12-21T12:33:12","date_gmt":"2023-12-21T04:33:12","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=13078"},"modified":"2023-12-21T12:33:12","modified_gmt":"2023-12-21T04:33:12","slug":"iosh5%e6%89%93%e5%8c%85%e5%b8%b8%e7%94%a8%e6%96%b9%e6%b3%95%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/13078\/","title":{"rendered":"iosh5\u6253\u5305\u5e38\u7528\u65b9\u6cd5\u4ecb\u7ecd"},"content":{"rendered":"

IOS H5\u6253\u5305\u662f\u5c06H5\u7f51\u9875\u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u3002\u5728I\u67e5\u770bios\u6253\u5305\u8bc1\u4e66\u8fc7\u671f\u65f6\u95f4<\/a>OS\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528UIWebView\u6216WKWebView\u7b49web\u89c6\u56fe\u5bb9\u5668\u6765\u6dfb\u52a0H5\u9875\u9762\uff0c\u4f7f\u5176\u80fd\u591f\u50cf\u4f20\u7edf\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u4e00\u6837\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u8fd0\u884c\u3002<\/p>\n

\u539f\u7406\u4ecb\u7ecd\uff1a<\/p>\n

IOS H5\u6253\u5305\u7684\u539f\u7406\u662f\u5c06H5\u9875\u9762\u901a\u8fc7Xcode\u5de5\u5177\u6253\u5305\u6210IOS\u7684Native APP\uff0c\u5176\u4e2dXcode\u662f\u82f9\u679c\u516c\u53f8\u5f00\u53d1\u7684\u5b98\u65b9IDE\u5de5\u5177\uff0c\u53ef\u7528\u4e8e\u5f00\u53d1IOS\u3001MAC\u548cApple Watch\u5e94\u7528\u7a0b\u5e8f\u3002\u5728Xcode\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0WebView\u63a7\u5236\u5668\u6765\u52a0\u8f7dH5\u9875\u9762\uff0c\u5e76\u5c06\u5176\u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u8be6\u7ec6\u4ecb\u7ecd\uff1a<\/p>\n

1. \u521b\u5efaXcode\u9879\u76ee<\/p>\n

\u9996\u5148\uff0c\u9700\u8981\u5728Xcode\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684IOS\u9879\u76ee\uff0c\u9009\u62e9Single View App\u6a21\u677f\uff0c\u547d\u540d\u5e94\u7528\u7a0b\u5e8f\u5e76\u9009\u62e9\u8bed\u8a00\u548c\u8bbe\u5907\u7c7b\u578b\u3002<\/p>\n

2. \u6dfb\u52a0WebView\u63a7\u5236\u5668<\/p>\n

\u63a5\u4e0b\u6765\uff0c\u9700\u8981\u5728Xcode\u4e2d\u6dfb\u52a0\u4e00\u4e2aWebView\u63a7\u5236\u5668\uff0c\u8be5\u63a7\u5236\u5668\u662f\u7528\u4e8e\u52a0\u8f7dH5\u9875\u9762\u7684\u3002\u53ef\u4ee5\u901a\u8fc7\u62d6\u62fd\u65b9\u5f0f\u5c06W<\/p>\n

<\/figure>\n<\/p>\n

ebView\u63a7\u5236\u5668\u6dfb\u52a0\u5230Storyboard\u4e2d\u3002<\/p>\n

3. \u914d\u7f6eWebView\u63a7\u5236\u5668<\/p>\n

\u5728\u6dfb\u52a0WebView\u63a7\u5236\u5668\u540e\uff0c\u9700\u8981\u5bf9\u5176\u8fdb\u884c\u914d\u7f6e\u3002\u53ef\u4ee5\u901a\u8fc7\u5728Storyboard\u4e2d\u9009\u62e9WebView\u63a7\u5236\u5668\u5e76\u5728\u5c5e\u6027\u68c0\u67e5\u5668\u4e2d\u8fdb\u884c\u914d\u7f6e\uff0c\u4f8b\u5982\u6dfb\u52a0NavigationBar\u548cToolBar\uff0c\u5e76\u8bbe\u7f6eWebView\u63a7\u5236\u5668\u7684\u521d\u59cb\u9875\u9762\u3002<\/p>\n

4. \u52a0\u8f7dH5\u9875\u9762<\/p>\n

\u914d\u7f6e\u597dWebView\u63a7\u5236\u5668\u540e\uff0c\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u8fdb\u884c\u52a0\u8f7dH5\u9875\u9762\u3002\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528UIWebView\u6216WKWebView\u7b49web\u89c6\u56fe\u5bb9\u5668\u6765\u52a0\u8f7dH5\u9875\u9762\u3002<\/p>\n

\u5728\u4f7f\u7528UIWebView\u52a0\u8f7dH5\u9875\u9762\u65f6\uff0c\u9700\u8981\u5728\u63a7\u5236\u5668\u4e2d\u521b\u5efaUIWebView\u5b9e\u4f8b\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u89c6\u56fe\u4e2d\u3002\u7136\u540e\uff0c\u901a\u8fc7NSURLRequest\u5bf9\u8c61\u6307\u5b9aH5\u9875\u9762\u7684URL\uff0c\u5e76\u4f7f\u7528UIWebView\u7684loadRequest\u65b9\u6cd5\u6765\u52a0\u8f7d\u9875\u9762\u3002<\/p>\n

\u5728\u4f7f\u7528WKWebView\u52a0\u8f7dH5\u9875\u9762\u65f6\uff0c\u4e0eUIWebView\u76f8\u6bd4\uff0c\u4f7f\u7528WKWebView\u80fd\u591f\u66f4\u597d\u5730\u652f\u6301JavaScript\u548cCSS\u6837\u5f0f\u7b49Web\u6807\u51c6\u3002\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528WKWebView\u7684load\u65b9\u6cd5\u5e76\u4f20\u9012\u4e00\u4e2aURLRequest\u5bf9\u8c61\u6765\u52a0\u8f7d\u9875\u9762\u3002<\/p>\n

5. \u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f<\/p>\n

\u5b8c\u6210\u52a0\u8f7dH5\u9875\u9762\u540e\uff0cflutter\u6253\u5305ios\u5305\u4f53\u79ef\u5927<\/a>\u9700\u8981\u5c06\u6574\u4e2a\u9879\u76ee\u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f\u3002\u53ef\u4ee5\u901a\u8fc7\u5728Xcode\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Scheme\u6765\u5b9e\u73b0\u3002Scheme\u53ef\u4ee5\u88ab\u770b\u4f5c\u662f\u4e00\u79cd\u8c03\u8bd5\u6216\u6253\u5305\u914d\u7f6e\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u7f16\u8bd1\u9009\u9879\u3001\u6784\u5efa\u8bbe\u7f6e\u548c\u8fd0\u884c\u9009\u9879\u7b49\u3002<\/p>\n

\u5728\u521b\u5efa\u5b8cScheme\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u9009\u62e9Product->Archive\u6765\u6253\u5305IOS\u5e94\u7528\u7a0b\u5e8f\u3002\u8be5\u8fc7\u7a0b\u4f1a\u751f\u6210\u4e00\u4e2aIPA\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u4e86\u6574\u4e2aIOS\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u7528\u4e8e\u53d1\u5e03\u548c\u5b89\u88c5\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u5728IOS\u7cfb\u7edf\u4e2d\uff0c\u4f7f\u7528Xcode\u5de5\u5177\u5c06H5\u9875\u9762\u6253\u5305\u6210Native APP\uff0c\u4f7f\u5176\u80fd\u591f\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u50cf\u4f20\u7edf\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u4e00\u6837\u8fd0\u884c\u3002\u901a\u8fc7UIWebView\u548cWKWebView\u7b49web\u89c6\u56fe\u5bb9\u5668\u53ef\u4ee5\u65b9\u4fbf\u5730\u52a0\u8f7dH5\u9875\u9762\uff0c\u5e76\u901a\u8fc7Xcode\u5de5\u5177\u5c06\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u4e00\u8fc7\u7a0b\u4f7f\u5f97H5\u9875\u9762\u80fd\u591f\u5728IOS\u8bbe\u5907\u4e0a\u66f4\u597d\u5730\u5c55\u793a\u4e0e\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

IOS H5\u6253\u5305\u662f\u5c06H5\u7f51\u9875\u6253\u5305\u6210IOS\u5e94\u7528\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u3002\u5728IOS\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528UIWebView\u6216WKWebView\u7b49web\u89c6\u56fe\u5bb9\u5668\u6765\u6dfb\u52a0H5\u9875\u9762\uff0c\u4f7f\u5176\u80fd\u591f\u50cf\u4f20\u7edf\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u4e00\u6837\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u8fd0<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[17855,17854,1402,12,361],"topic":[],"class_list":["post-13078","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-iosxcodeipa","tag-iosbetatest","tag-1402","tag-12","tag-361"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/13078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=13078"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/13078\/revisions"}],"predecessor-version":[{"id":13131,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/13078\/revisions\/13131"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=13078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=13078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=13078"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=13078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}