{"id":5730,"date":"2023-09-25T15:30:52","date_gmt":"2023-09-25T07:30:52","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=5730"},"modified":"2023-09-25T15:30:52","modified_gmt":"2023-09-25T07:30:52","slug":"%e6%89%8b%e6%9c%ba%e7%bd%91%e9%a1%b5%e6%89%93%e5%8c%85app%e6%9c%89%e9%82%a3%e5%87%a0%e6%ad%a5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/5730\/","title":{"rendered":"\u624b\u673a\u7f51\u9875\u6253\u5305app\u6709\u90a3\u51e0\u6b65\uff1f"},"content":{"rendered":"

\u5982\u4f55\u5c06\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\uff1f\u2014\u2014\u4ece\u539f\u7406\u5230\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n

\u968f\u7740\u79fb\u52a8\u4e92\u8054\u7f51\u7684\u666e\u53ca\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u4f01\u4e1a\u548c\u4e2a\u4eba\u5f00\u59cb\u5c06\u81ea\u5df1\u7684\u7f51\u7ad9\u6253\u5305\u6210APP\uff0c\u4ee5\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u4fbf\u6377\u6027\u3002\u672c\u6587\u5c06\u4ee51000\u5b57\u7684\u7bc7\u5e45\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\u7684\u539f\u7406\u548c\u65b9\u6cd5\u3002<\/p>\n

1. \u624b\u673a\u7f51\u9875\u6253\u5305APP\u7684\u539f\u7406<\/p>\n

\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\u7684\u6838\u5fc3\u662f\u5c06\u7f51\u9875\u5185\u5bb9\u5d4c\u5165\u5230\u4e00\u4e2a\u79fb\u52a8\u5e94\u7528\u7684\u5bb9\u5668\u4e2d\uff0c\u4f7f\u5176\u5448\u73b0\u548c\u64cd\u4f5c\u65b9\u5f0f\u66f4\u63a5\u8fd1\u4e8e\u539f\u751f\u5e94\u7528\u3002\u8fd9\u4e2a\u5bb9\u5668\u901a\u5e38\u88ab\u79f0\u4e3a\u201cWebView\u201d\uff0c\u662f\u4e00\u4e2a\u53ef\u4ee5\u52a0\u8f7d\u548c\u663e\u793a\u7f51\u9875\u5185\u5bb9\u7684\u7ec4\u4ef6\u3002WebView\u662f\u76ee\u524d\u5927\u591a\u6570\u79fb\u52a8\u64cd\u4f5c\u7cfb\u7edf\uff08\u5982Android\u548ciOS\uff09\u90fd\u652f\u6301\u7684\u529f\u80fd\u3002<\/p>\n

\u901a\u8fc7\u5728APP\u4e2d\u96c6\u6210\u4e00\u4e2aWebView\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5c06\u7f51\u9875\u5185\u5bb9\u5d4c\u5165\u5230APP\u91cc\uff0c\u4ece\u800c\u5b9e\u73b0\u7f51\u9875\u548cAPP\u4e4b\u95f4\u7684\u65e0\u7f1d\u7ed3\u5408\u3002\u8fd9\u79cd\u5e94\u7528\u901a\u5e38\u88ab\u79f0\u4e3a\u201cHybrid App\u201d\u6216\u201cWeb App\u201d\u3002<\/p>\n

\u7f51\u9875\u6253\u5305APP\u7684\u8fc7\u7a0b\u53ef\u4ee5\u603b\u7ed3\u4e3a\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n

1.1 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u79fb\u52a8\u5e94\u7528\u9879\u76ee\uff08\u53ef\u4ee5\u662fAndroid\u6216\u8005iOS\uff09\u3002<\/p>\n

1.2 \u5f15\u5165WebView\u7ec4\u4ef6\u5e76\u914d\u7f6e\u76f8\u5173\u53c2\u6570\uff08\u5982\u52a0\u8f7dURL\u3001\u542f\u7528JavaScript\u7b49\uff09\u3002<\/p>\n

1.3 \u5bf9WebView\u8fdb\u884c\u6837\u5f0f\u8c03\u6574\uff0c\u4f7f\u5176\u5728APP\u4e2d\u5448\u73b0\u5f97\u66f4\u52a0\u7f8e\u89c2\u3002<\/p>\n

1.4 \u6dfb\u52a0\u4e0e\u79fb\u52a8\u8bbe\u5907\u539f\u751f\u529f\u80fd\uff08\u5982\u6444\u50cf\u5934\u3001GPS\u7b49\uff09\u7684\u4ea4\u4e92\u652f\u6301\u3002<\/p>\n

1.5 \u7f16\u8bd1\u6253\u5305\u6210\u5b89\u88c5\u5305\uff08\u5982APK\u6216IPA\u6587\u4ef6\uff09\uff0c\u4f9b\u7528\u6237\u4e0b\u8f7d\u548c\u5b89\u88c5\u3002<\/p>\n

2. \u624b\u673a\u7f51\u9875\u6253\u5305APP\u7684\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n

\u8981\u5c06\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\uff0c\u9996\u5148\u8981\u9009\u62e9\u4e00\u4e2a\u9002\u5408\u81ea\u5df1\u9700\u6c42\u7684\u6253\u5305\u5de5\u5177\u3002\u76ee\u524d\u5e02\u9762\u4e0a\u6709\u5f88\u591a\u5de5\u5177\u53ef\u4f9b\u9009\u62e9\uff0c\u5176\u4e2d\u90e8\u5206\u5f00\u6e90\u548c\u5546\u4e1a\u5c01\u88c5app\u548c\u539f\u751fapp<\/a>\u5de5\u5177\u5982\u4e0b\uff1a<\/p>\n

2.1 Apache Cordova\uff1aApache Cordova\u662f\u4e00\u4e2a\u8457\u540d\u7684\u5f00\u6e90Hybrid App\u5f00\u53d1\u6846\u67b6\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u8de8\u5e73\u53f0\u7684API\u63a5\u53e3\uff0c\u8ba9\u5f00\u53d1\u8005\u53ef\u4ee5\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u7b49Web\u6280\u672f\u5f00\u53d1\u79fb\u52a8\u5e94\u7528\u3002Cordova\u652f\u6301Android\u3001iOS\u3001Windows Phone\u7b49\u591a\u4e2a\u5e73\u53f0\u3002<\/p>\n

2.2 PhoneGap\uff1aPhoneGap\u662f\u57fa\u4e8eCordova\u5f00\u53d1\u7684\u4e00\u4e2a\u5f00\u6e90\u5546\u4e1a\u5de5\u5177\uff0c\u5b83\u8fdb\u4e00\u6b65\u5c01\u88c5\u4e86Cordova\u7684\u529f\u80fd\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e9b\u989d\u5916\u7684\u5b9a\u5236\u548c\u589e\u5f3a\u529f\u80fd\u3002PhoneGap\u63d0\u4f9b\u4e86\u4e91\u7aef\u7f16\u8bd1\u670d\u52a1\uff0c\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u5c06\u4ee3\u7801\u4e0a\u4f20\u5230\u4e91\u7aef\u670d\u52a1\u5668\uff0c\u7136\u540e\u751f\u6210\u5bf9\u5e94\u5e73\u53f0\u7684\u5b89\u88c5\u5305\u3002<\/p>\n

2.3 Ionic\uff1aIonic\u662f\u4e00\u4e2a\u57fa\u4e8eAngularJS\u548cCordova\u7684\u5f00\u6e90\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684UI\u7ec4\u4ef6\u548c\u529f\u80fd\u5e93\uff0c\u65b9\u4fbf\u5f00\u53d1\u8005\u5feb\u901f\u642d\u5efa\u5e94\u7528\u754c\u9762\u548c\u5b9e\u73b0\u529f\u80fd\u3002Ionic\u652f\u6301Android\u3001iOS\u3001Windo<\/p>\n

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

ws Phone\u7b49\u5e73\u53f0\u3002<\/p>\n

\u8fd9\u91cc\u4ee5Apache Cordova\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u5982\u4f55\u5c06\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\uff1a<\/p>\n

2.4 \u5b89\u88c5Apache Cordova\uff1a\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5Node.js\u73af\u5883\uff0c\u7136\u540e\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5b89\u88c5Apache Cordova\uff1a<\/p>\n

“`<\/p>\n

npm install -g cordova<\/p>\n

“`<\/p>\n

2.5 \u521b\u5efaCordova\u9879\u76ee\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u5728\u6307\u5b9a\u76ee\u5f55\u521b\u5efa\u4e00\u4e2aCordova\u9879\u76ee\uff1a<\/p>\n

“`<\/p>\n

cordova create myApp com.example.myapp MyApp<\/p>\n

“`<\/p>\n

2.6 \u6dfb\u52a0\u5e73\u53f0\u652f\u6301\uff1a\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u4e3a\u9879\u76ee\u6dfb\u52a0Android\u6216iOS\u5e73\u53f0\u652f\u6301\uff08\u9700\u8981\u5148\u5b89\u88c5\u76f8\u5e94\u7684\u5f00\u5c06\u67d0\u4e2a\u7f51\u5740\u5c01\u88c5\u6210app<\/a>\u53d1\u73af\u5883\uff09\uff1a<\/p>\n

“`<\/p>\n

cd myApp<\/p>\n

cordova platform add android<\/p>\n

cordova platform add ios<\/p>\n

“`<\/p>\n

2.7 \u96c6\u6210\u7f51\u9875\u5185\u5bb9\uff1a\u5c06\u81ea\u5df1\u7684\u7f51\u9875\u5185\u5bb9\uff08\u5305\u62ecHTML\u3001CSS\u3001JavaScript\u6587\u4ef6\u7b49\uff09\u62f7\u8d1d\u5230\u9879\u76ee\u7684\u201cwww\u201d\u6587\u4ef6\u5939\u4e0b\uff0c\u7136\u540e\u4fee\u6539\u201cwww\/index.html\u201d\u6587\u4ef6\uff0c\u5f15\u5165\u81ea\u5df1\u7684\u7f51\u9875\u3002<\/p>\n

2.8 \u914d\u7f6eWebView\uff1a\u5728\u201cconfig.xml\u201d\u6587\u4ef6\u4e2d\u914d\u7f6eWebView\u53c2\u6570\uff0c\u5982\u8bbe\u7f6e\u52a0\u8f7dURL\u3001\u542f\u7528JavaScript\u7b49\u529f\u80fd\u3002<\/p>\n

2.9 \u6dfb\u52a0\u539f\u751f\u529f\u80fd\u652f\u6301\uff1a\u4f7f\u7528Cordova\u63d2\u4ef6\u7cfb\u7edf\u6dfb\u52a0\u5bf9\u624b\u673a\u6444\u50cf\u5934\u3001GPS\u7b49\u539f\u751f\u529f\u80fd\u7684\u652f\u6301\u3002<\/p>\n

2.10 \u7f16\u8bd1\u6253\u5305APP\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177\u7f16\u8bd1\u6253\u5305APP\u5e76\u751f\u6210\u5b89\u88c5\u5305\u6587\u4ef6\uff1a<\/p>\n

“`<\/p>\n

cordova build android<\/p>\n

cordova build ios<\/p>\n

“`<\/p>\n

\u5b8c\u6210\u4ee5\u4e0a\u6b65\u9aa4\u540e\uff0c\u5c31\u53ef\u4ee5\u5c06\u751f\u6210\u7684\u5b89\u88c5\u5305\u5206\u4eab\u7ed9\u7528\u6237\u4e0b\u8f7d\u548c\u5b89\u88c5\u4e86\u3002<\/p>\n

\u603b\u4e4b\uff0c\u5c06\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\u7684\u8fc7\u7a0b\u5e76\u4e0d\u590d\u6742\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u6253\u5305\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u9700\u8981\u5bf9\u7f51\u9875\u8fdb\u884c\u4e00\u5b9a\u7684\u4f18\u5316\u548c\u8c03\u6574\uff0c\u4ee5\u9002\u5e94\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u548c\u5c4f\u5e55\u5c3a\u5bf8\u3002\u901a\u8fc7\u6253\u5305\u6210APP\uff0c\u53ef\u4ee5\u63d0\u9ad8\u7528\u6237\u7684\u4f7f\u7528\u4f53\u9a8c\u548c\u4fbf\u6377\u6027\uff0c\u6269\u5927\u4ea7\u54c1\u7684\u5e94\u7528\u8303\u56f4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5982\u4f55\u5c06\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP\uff1f\u2014\u2014\u4ece\u539f\u7406\u5230\u8be6\u7ec6\u4ecb\u7ecd\u968f\u7740\u79fb\u52a8\u4e92\u8054\u7f51\u7684\u666e\u53ca\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u4f01\u4e1a\u548c\u4e2a\u4eba\u5f00\u59cb\u5c06\u81ea\u5df1\u7684\u7f51\u7ad9\u6253\u5305\u6210APP\uff0c\u4ee5\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u4fbf\u6377\u6027\u3002\u672c\u6587\u5c06\u4ee51000\u5b57\u7684\u7bc7\u5e45\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u624b\u673a\u7f51\u9875\u6253\u5305\u6210APP<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[9226,10609,573,1482,149],"topic":[],"class_list":["post-5730","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-apph5","tag-discuzapp","tag-573","tag-1482","tag-149"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5730","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\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=5730"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5730\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=5730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=5730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=5730"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=5730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}