{"id":5756,"date":"2023-09-26T13:04:40","date_gmt":"2023-09-26T05:04:40","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=5756"},"modified":"2023-09-26T13:04:40","modified_gmt":"2023-09-26T05:04:40","slug":"%e6%80%8e%e4%b9%88%e5%b0%86%e7%bd%91%e9%a1%b5%e6%89%93%e5%8c%85%e5%b0%81%e8%a3%85%e6%88%90%e8%8b%b9%e6%9e%9capp%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/5756\/","title":{"rendered":"\u600e\u4e48\u5c06\u7f51\u9875\u6253\u5305\u5c01\u88c5\u6210\u82f9\u679capp\uff1f"},"content":{"rendered":"
\u7f51\u9875\u53ef\u4ee5\u901a\u8fc7\u5c01\u88c5\u6210\u82f9\u679cApp\u7684\u65b9\u5f0f\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u5728\u624b\u673a\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528\uff0c\u800c\u4e0d\u9700\u8981\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u3002\u5c01\u88c5\u7f51\u9875\u6210App\u7684\u539f\u7406\u4e3b\u8981\u4f9d\u9760WebView\u548c\u6846\u67b6\uff0c\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5c01\u88c5\u7f51\u9875\u6210\u82f9\u679cApp\u7684\u8fc7\u7a0b\u3002<\/p>\n
1. WebView\uff1aWebView\u662f\u4e00\u4e2a\u6d4f\u89c8\u5668\u63a7\u4ef6\uff0c\u53ef\u4ee5\u5728App\u4e2d\u52a0\u8f7d\u7f51\u9875\u3002\u901a\u8fc7\u4f7f\u7528WebView\uff0c\u53ef\u4ee5\u5c06\u7f51\u9875\u4ee5\u53ca\u5176\u76f8\u5173\u7684HTML\u3001CSS\u3001JavaScript\u7b49\u6587\u4ef6\u52a0\u8f7d\u5230App\u4e2d\u663e\u793a\u3002<\/p>\n
2. \u521b\u5efa\u65b0\u7684App\u5de5\u7a0b\uff1a\u9996\u5148\uff0c\u9700\u8981\u5728Xcode\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684App\u5de5\u7a0b\u3002\u9009\u62e9”Single View App”\u6a21\u677f\uff0c\u8bbe\u7f6eApp\u7684\u540d\u79f0\u3001Bundle Identifier\u7b49\u57fa\u672c\u4fe1\u606f\uff0c\u5e76\u9009\u62e9\u9002\u5f53\u7684\u8bed\u8a00\u548c\u8bbe\u5907\u7c7b\u578b\u3002<\/p>\n
3. \u5bfc\u5165WebView\uff1a\u5728\u521b\u5efa\u7684\u5de5\u7a0b\u4e2d\uff0c\u9700\u8981\u5bfc\u5165WebKit\u5e93\uff0c\u4ee5\u4fbf\u4f7f\u7528WebView\u63a7\u4ef6\u3002\u5728Xcode\u4e2d\uff0c\u9009\u62e9\u5de5\u7a0b\u9879\u76ee\uff0c\u5728”General”\u9009\u9879\u5361\u4e2d\u627e\u5230”Frameworks, Libraries and Embedded Content”\uff0c\u70b9\u51fb”+”\u6309\u94ae\uff0c\u7136\u540e\u9009\u62e9”WebKit.framework”\u5bfc\u5165\u3002<\/p>\n
4. \u8bbe\u8ba1App\u754c\u9762\uff1a\u53ef\u4ee5\u6839\u636e\u9700\u8981\u81ea\u5b9a\u4e49App\u7684\u754c\u9762\u3002\u53ef\u4ee5\u9009\u62e9\u5c06WebView\u5168\u5c4f\u663e\u793a\uff0c\u6216\u8005\u5728\u5176\u4ed6\u89c6\u56fe\u63a7\u4ef6\u4e2d\u5d4c\u5165WebView\u3002<\/p>\n
5. \u52a0\u8f7d\u7f51\u9875\uff1a\u5728App\u7684\u4ee3\u7801\u4e2d\u91cd\u65b0\u6253\u5305\u82f9\u679c\u5b98\u7f51app<\/a>\uff0c\u53ef\u4ee5\u4f7f\u7528WebView\u52a0\u8f7d\u7f51\u9875\u3002\u5728\u9700\u8981\u52a0\u8f7d\u7f51\u9875\u7684\u5730\u65b9\uff0c\u8c03\u7528WebView\u7684loadRequest\u65b9\u6cd5\uff0c\u8bbe\u7f6e\u8981\u52a0\u8f7d\u7684URL\u6216HTML\u6587\u4ef6\u5373<\/p>\n \u53ef\u3002<\/p>\n 6. \u5904\u7406\u4ea4\u4e92\u4e8b\u4ef6\uff1a\u901a\u8fc7WebView\u7684\u4ee3\u7406\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5904\u7406\u7528\u6237\u7684\u4ea4\u4e92\u4e8b\u4ef6\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u5728\u7528\u6237\u70b9\u51fb\u94fe\u63a5\u65f6\u6253\u5f00\u65b0\u7684WebView\u9875\u9762\uff0c\u6216\u8005\u6839\u636e\u7528\u6237\u7684\u8f93\u5165\u505a\u76f8\u5e94\u7684\u64cd\u4f5c\u3002<\/p>\n 7. \u81ea\u5b9a\u4e49\u529f\u80fd\u548c\u6837\u5f0f\uff1a\u53ef\u4ee5\u6839\u636e\u9700\u8981\u81ea\u5b9a\u4e49App\u7684\u529f\u80fd\u548c\u6837\u5f0f\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u6dfb\u52a0\u5bfc\u822a\u680f\u3001\u5de5\u5177\u680f\uff0c\u6216\u8005\u66f4\u6539WebView\u7684\u80cc\u666f\u8272\u3001\u5b57\u4f53\u3001\u7f29\u653e\u6bd4\u4f8b\u7b49\u3002<\/p>\n 8. \u6253\u5305\u548c\u5206\u53d1\uff1a\u5b8c\u6210App\u7684\u8bbe\u8ba1\u548c\u5f00\u53d1\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7Xcode\u5c06App\u6253\u5305\u6210.ipa\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528\u82f9\u679c\u5f00\u53d1\u8005\u8d26\u53f7\u8fdb\u884c\u7b7e\u540d\u548c\u5206\u53d1\u3002<\/p>\n \u5c01\u88c5\u7f51\u9875\u6210\u82f9\u679cApp\u7684\u8fc7\u7a0b\u5927\u81f4\u5982\u4e0a\u6240\u8ff0\uff0c\u901a\u8fc7WebView\u52a0\u8f7d\u7f51\u9875\uff0c\u7ed3\u5408\u81ea\u5b9a\u4e49\u7684\u529f\u80fd\u548c\u6837\u5f0f\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5c06\u7f51\u9875\u5c01\u88c5\u6210\u4e00\u4e2a\u72ec\u7acb\u7684App\u3002\u8fd9\u6837\uff0c\u7528\u6237\u53ef\u4ee5\u50cf\u4f7f\u7528\u5176\u4ed6App\u4e00\u6837\uff0c\u4eceApp Sto\u82f9\u679capp\u600e\u4e48\u6253\u5305\u5230\u7b2c\u4e09\u65b9<\/a>re\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5App\uff0c\u7136\u540e\u76f4\u63a5\u5728\u624b\u673a\u4e0a\u4f7f\u7528\u3002<\/p>\n \u5c01\u88c5\u7f51\u9875\u6210\u82f9\u679cApp\u7684\u597d\u5904\u5728\u4e8e\uff0c\u53ef\u4ee5\u4e3a\u7f51\u9875\u5185\u5bb9\u63d0\u4f9b\u66f4\u52a0\u4fbf\u6377\u548c\u4f18\u5316\u7684\u8bbf\u95ee\u65b9\u5f0f\u3002\u540c\u65f6\uff0c\u7531\u4e8eApp\u901a\u5e38\u5177\u6709\u66f4\u597d\u7684\u6027\u80fd\u548c\u7528\u6237\u4f53\u9a8c\uff0c\u5c01\u88c5\u6210App\u540e\uff0c\u7f51\u9875\u53ef\u80fd\u4f1a\u83b7\u5f97\u66f4\u591a\u7684\u7528\u6237\u548c\u66f4\u9ad8\u7684\u4f7f\u7528\u7387\u3002<\/p>\n \u7136\u800c\uff0c\u5c01\u88c5\u7f51\u9875\u6210App\u4e5f\u5b58\u5728\u4e00\u4e9b\u9650\u5236\u548c\u6ce8\u610f\u4e8b\u9879\u3002\u4f8b\u5982\uff0c\u7531\u4e8eWebView\u7684\u6027\u80fd\u548c\u529f\u80fd\u6709\u9650\uff0c\u67d0\u4e9b\u9ad8\u7ea7\u7279\u6027\u53ef\u80fd\u65e0\u6cd5\u5728App\u4e2d\u5b8c\u5168\u5c55\u793a\uff1b\u8fd8\u9700\u8981\u8c28\u614e\u5904\u7406\u7f51\u9875\u4e2d\u7684\u654f\u611f\u4fe1\u606f\u548c\u7528\u6237\u9690\u79c1\uff0c\u907f\u514d\u9020\u6210\u5b89\u5168\u95ee\u9898\u7b49\u3002<\/p>\n \u603b\u4e4b\uff0c\u5c01\u88c5\u7f51\u9875\u6210\u82f9\u679cApp\u7684\u8fc7\u7a0b\u76f8\u5bf9\u8f83\u7b80\u5355\uff0c\u53ea\u9700\u8981\u4f7f\u7528WebView\u548c\u6846\u67b6\u8fdb\u884c\u57fa\u672c\u7684\u8bbe\u8ba1\u548c\u5f00\u53d1\u5de5\u4f5c\u5373\u53ef\u3002\u901a\u8fc7\u5c01\u88c5\uff0c\u53ef\u4ee5\u4e3a\u7f51\u9875\u63d0\u4f9b\u66f4\u597d\u7684\u8bbf\u95ee\u65b9\u5f0f\u548c\u7528\u6237\u4f53\u9a8c\uff0c\u5e76\u6269\u5927\u7f51\u9875\u7684\u5f71\u54cd\u529b\u548c\u4f7f\u7528\u8303\u56f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u7f51\u9875\u53ef\u4ee5\u901a\u8fc7\u5c01\u88c5\u6210\u82f9\u679cApp\u7684\u65b9\u5f0f\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u5728\u624b\u673a\u4e0a\u5b89\u88c5\u548c\u4f7f\u7528\uff0c\u800c\u4e0d\u9700\u8981\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u3002\u5c01\u88c5\u7f51\u9875\u6210App\u7684\u539f\u7406\u4e3b\u8981\u4f9d\u9760WebView\u548c\u6846\u67b6\uff0c\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5c01\u88c5\u7f51\u9875\u6210\u82f9\u679cApp\u7684\u8fc7\u7a0b\u30021. W<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[33,160,91,149,7759],"topic":[],"class_list":["post-5756","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-androidstudioapp","tag-160","tag-91","tag-149","tag-app"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5756","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\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=5756"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5756\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=5756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=5756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=5756"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=5756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<\/figure>\n<\/p>\n