{"id":27829,"date":"2024-03-26T18:28:08","date_gmt":"2024-03-26T10:28:08","guid":{"rendered":"https:\/\/app.60day.cn\/appday\/?p=27829"},"modified":"2024-03-26T18:28:08","modified_gmt":"2024-03-26T10:28:08","slug":"%e7%bd%91%e7%ab%99%e7%94%9f%e6%88%90%e8%8b%b9%e6%9e%9capp%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/app.60day.cn\/appday\/kaifaapp\/27829\/","title":{"rendered":"\u7f51\u7ad9\u751f\u6210\u82f9\u679capp\u5982\u4f55\u5b89\u88c5\uff1f"},"content":{"rendered":"<p># \u7f51\u7ad9\u751f\u6210\u82f9\u679cAPP\uff1a\u539f\u7406\u4e0e\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>\u8981\u5c06\u73b0\u6709\u7f51\u7ad9\u751f\u6210\u4e3a\u82f9\u679cAPP\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u7c7b\u4f3c\u4e8e\u6df7\u5408App\u6846\u67b6\u7684\u89e3\u51b3\u65b9\u6848\u3002\u8fd9\u6837\u7684\u6846\u67b6\u53ef\u4ee5\u8ba9\u4f60\u4f7f\u7528\u4f60\u7684\u7f51\u7ad9\u7684HTML\u3001CSS\u3001JavaScript\u4ee3\u7801\u6765\u521b\u5efa\u4e00\u4e2a\u53ef\u4ee5\u5728iOS\u8bbe\u5907\u4e0a\u8fd0\u884c\u3001\u5b89\u88c5\u7684APP\u3002\u672c\u6587\u5c06\u56f4\u7ed5\u8fd9\u4e2a\u539f\u7406\uff0c\u6765\u7ed9\u4f60\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u751f\u6210\u4e00\u4e2a\u82f9\u679cAPP\u3002<\/p>\n<p>## 1. \u4ec0\u4e48\u662f\u6df7\u5408App\u6846\u67b6\uff1f<\/p>\n<p>\u6df7\u5408App\u6846\u67b6\u662f\u4e00\u79cd\u5141\u8bb8Web\u5f00\u53d1\u8005\u4f7f\u7528Web\u6280\u672f\uff08HTML\u3001CSS\u3001JavaScript\uff09\u521b\u5efa\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u7684\u5de5\u5177\uff0c\u540c\u65f6\u4ecd\u7136\u53ef\u4ee5\u8ba9\u4ed6\u4eec\u4f7f\u7528\u8bbe\u5907\u7684\u672c\u5730\u7279\u6027\uff0c\u5982\u76f8\u673a\u3001GPS\u7b49\u3002Apache Cordova\uff08\u524d\u79f0PhoneGap\uff09\u548cIonic\u7b49\u662f\u8f83\u4e3a\u6d41\u884c\u7684\u6df7\u5408APP\u6846\u67b6\u4e4b\u4e00\u3002<\/p>\n<p>## 2. \u5982\u4f55\u4f7f\u7528\u6df7\u5408App\u6846\u67b6\u751f\u6210\u82f9\u679cAPP\uff1f<\/p>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528Apache Cordova\u6765\u5c06\u60a8\u7684\u7f51\u7ad9\u751f\u6210\u4e3a\u82f9\u679cAPP\u7684\u65b9\u6cd5\u3002<\/p>\n<p>### 2.1 \u51c6\u5907\u5de5\u4f5c<\/p>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u51c6\u5907\u4ee5\u4e0b\u73af\u5883\u548c\u8f6f\u4ef6\uff1a<\/p>\n<p>1. \u7535\u8111\uff1a\u9700\u8981\u4e00\u53f0\u5b89\u88c5\u6709macOS\u7cfb\u7edf\u7684\u7535\u8111\u6765\u5b8c\u6210\u5f00\u53d1\u5de5\u4f5c\uff0c\u56e0\u4e3a\u5728\u5176\u4ed6\u5e73\u53f0\u4e0a\u4e0d\u80fd\u521b\u5efaiOS APP\u3002<\/p>\n<p>2. Xcode\uff1a\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Xcode\uff0c\u901a\u8fc7\u8bbf\u95eeMac App Store\u6765\u4e0b\u8f7d\u5b89\u88c5\u3002<\/p>\n<p>3. Node.js\uff1a\u5b89\u88c5Node.js\u73af\u5883\uff0c\u4f60\u53ef\u4ee5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5b89\u88c5\u3002https:\/\/nodejs.org<\/p>\n<p>4. Cordova CLI\uff1a\u5b89\u88c5Apache Cordova\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u901a\u8fc7\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>npm install -g cordova<\/p>\n<p>&#8220;`<\/p>\n<p>### 2.2 \u9879\u76ee\u521b\u5efa<\/p>\n<p>1. \u6253\u5f00\u7ec8\u7aef\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Cordova\u9879\u76ee\uff0c\u5176\u4e2d`MyApp`\u662f\u60a8\u7684App\u540d\u79f0\uff0c`com.example<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-01\/06\/16\/05255246526.jpg\" \/><\/figure>\n<\/p>\n<p>.myapp`\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u6807\u8bc6\u7b26\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>cordova create MyApp com.example.myapp<\/p>\n<p>&#8220;`<\/p>\n<p>2. \u8fdb\u5165\u4f60\u521a\u521a\u521b\u5efa\u7684\u9879\u76ee\u76ee\u5f55\uff1a <\/p>\n<p>&#8220;`<\/p>\n<p>cd MyApp<\/p>\n<p>&#8220;`<\/p>\n<p>3. \u5c06iOS\u5e73\u53f0\u6dfb\u52a0\u5230\u60a8\u7684\u9879\u76ee\u4e2d\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>cordova platform add ios<\/p>\n<p>&#8220;`<\/p>\n<p>\u6b64\u65f6\uff0c\u60a8\u7684\u9879\u76ee\u5df2\u7ecf\u57fa\u672c\u642d\u5efa\u5b8c\u6210\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u4e3a\u5176\u6dfb\u52a0\u7f51\u7ad9\u4ee3\u7801\u3002<\/p>\n<p>### 2.3 \u6dfb\u52a0\u7f51\u7ad9\u4ee3\u7801<\/p>\n<p>\u73b0\u5728\uff0c\u5c06\u60a8\u7684\u7f51\u7ad9\u6e90\u4ee3\u7801\u653e\u5230Cordova\u9879\u76ee\u7684 `www` \u6587\u4ef6\u5939\u4e2d\u3002\u5178\u578b\u7684\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b:<\/p>\n<p>&#8220;`<\/p>\n<p>&#8211; MyApp\/<\/p>\n<p>  &#8211; hooks\/<\/p>\n<p><a href=\"http:\/\/www.yimenyun.cn\/zaixian-shengcheng-app-105.html\">\u5728\u7ebfapp\u793e\u533a\u751f\u6210\u5e73\u53f0<\/a><\/p>\n<p>  &#8211; node_modules\/<\/p>\n<p>  &#8211; platforms\/<\/p>\n<p>  &#8211; plugins\/<\/p>\n<p>  &#8211; www\/ \uff08\u5c06\u4f60\u7684\u7f51\u7ad9\u4ee3\u7801\u653e\u5728\u8fd9\u91cc\uff09<\/p>\n<p>    &#8211; css\/<\/p>\n<p>    &#8211; img\/<\/p>\n<p>    &#8211; js\/<\/p>\n<p>    &#8211; index.html<\/p>\n<p>  &#8211; config.xml<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728HTML\u4ee3\u7801\u4e2d\uff0c\u5982\u6709\u8de8\u57df\u8bf7\u6c42\uff0c\u8bf7\u8bbe\u7f6eCordova\u7684`Content Security Policy`\uff0c\u4ee5\u5141\u8bb8\u7f51\u7edc\u8bbf\u95ee\u3002<\/p>\n<p>### 2.4 \u5728iOS\u8bbe\u5907\u4e0a\u6d4b\u8bd5<\/p>\n<p>\u5efa\u8bae\u5c06\u60a8\u7684iOS\u8bbe\u5907\u8fde\u63a5\u5230\u7535\u8111\u8fdb\u884c\u6d4b\u8bd5\u3002\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:<\/p>\n<p>&#8220;`<\/p>\n<p>cordova build ios<\/p>\n<p>cordova run ios<\/p>\n<p>&#8220;`<\/p>\n<p>\u6b64\u65f6\uff0c\u60a8\u5e94\u8be5\u53ef\u4ee5\u770b\u5230\u60a8\u7684APP\u5728iOS\u8bbe\u5907\u4e0a\u6210\u529f\u8fd0\u884c\u3002<\/p>\n<p>### 2.5 \u53d1\u5e03\u548c\u63d0\u4ea4\u81f3App Store<\/p>\n<p>\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u9879\u76ee\u6784\u5efa\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>cordova build ios &#8211;release<\/p>\n<p>&#8220;`<\/p>\n<p>\u6784\u5efa\u5b8c\u6210\u540e\uff0c\u60a8\u5c06\u83b7\u5f97\u4e00\u4e2a `.xcarchive` \u6587\u4ef6\u3002\u4f7f\u7528Xcode\u6253\u5f00\u9879\u76ee\u4e2d\u7684 `platforms\/ios\/MyApp.xcworkspace`\uff0c\u5e76\u9075\u5faa\u82f9\u679c\u7684\u53d1\u5e03\u6307\u5357\uff0c\u5b8c\u6210APP\u7b7e\u540d\u3001\u9a8c\u8bc1\u4ee5\u53ca\u5c06\u751f\u6210\u7684APP\u63d0\u4ea4\u81f3App Store\u7b49<a href=\"http:\/\/www.yimenyun.cn\/app-shengcheng-gongju-481.html\">pro\u7f51\u7ad9\u751f\u6210app\u5de5\u5177<\/a>\u540e\u7eed\u6d41\u7a0b\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u4f7f\u7528\u6df7\u5408App\u6846\u67b6\uff0c\u5c06\u60a8\u7684\u7f51\u7ad9\u751f\u6210\u4e3a\u4e00\u4e2a\u53ef\u4ee5\u5728\u82f9\u679c\u8bbe\u5907\u4e0a\u8fd0\u884c\u7684APP\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p># \u7f51\u7ad9\u751f\u6210\u82f9\u679cAPP\uff1a\u539f\u7406\u4e0e\u8be6\u7ec6\u4ecb\u7ecd\u8981\u5c06\u73b0\u6709\u7f51\u7ad9\u751f\u6210\u4e3a\u82f9\u679cAPP\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u7c7b\u4f3c\u4e8e\u6df7\u5408App\u6846\u67b6\u7684\u89e3\u51b3\u65b9\u6848\u3002\u8fd9\u6837\u7684\u6846\u67b6\u53ef\u4ee5\u8ba9\u4f60\u4f7f\u7528\u4f60\u7684\u7f51\u7ad9\u7684HTML\u3001CSS\u3001JavaScript\u4ee3\u7801\u6765\u521b\u5efa\u4e00\u4e2a\u53ef<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10517,11194,435,22,728],"topic":[],"class_list":["post-27829","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-app","tag-htmlapp","tag-435","tag-22","tag-728"],"_links":{"self":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/27829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/comments?post=27829"}],"version-history":[{"count":1,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/27829\/revisions"}],"predecessor-version":[{"id":28216,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/posts\/27829\/revisions\/28216"}],"wp:attachment":[{"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/media?parent=27829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/categories?post=27829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/tags?post=27829"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/app.60day.cn\/appday\/wp-json\/wp\/v2\/topic?post=27829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}