{"id":5228,"date":"2023-09-20T12:33:40","date_gmt":"2023-09-20T04:33:40","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=5228"},"modified":"2023-09-20T12:33:40","modified_gmt":"2023-09-20T04:33:40","slug":"html5%e6%89%93%e5%8c%85ios%e8%bf%90%e8%a1%8c%e6%b5%81%e7%a8%8b%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/5228\/","title":{"rendered":"html5\u6253\u5305ios\u8fd0\u884c\u6d41\u7a0b\u4ecb\u7ecd"},"content":{"rendered":"

HTML5\u662f\u4e00\u79cd\u7528\u4e8e\u6784\u5efa\u7f51\u9875\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u6807\u51c6\u5316\u6280\u672f\u3002\u5b83\u901a\u8fc7\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u6765\u521b\u5efa\u4ea4\u4e92\u6027\u4e30\u5bcc\u7684\u7f51\u9875\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5728\u8fc7\u53bb\uff0cHTML5\u4e3b\u8981\u7528\u4e8e\u5728Web\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\uff0c\u4f46\u73b0\u5728\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u5c06HTML5\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u6210\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\uff0c\u4ee5\u5728\u79fbuniapp\u6253\u5305ios \u6536\u8d39<\/a>\u52a8\u8bbe\u5907\u4e0a\u8fd0\u884c\u3002<\/p>\n

\u5728iOS\u5e73\u53f0\u4e0a\u6253\u5305\u548c\u8fd0\u884cHTML5\u5e94\u7528\u7a0b\u5e8f\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528Cordova\uff08\u524d\u79f0\u4e3aPhoneGap\uff09\u8fd9\u6837\u7684\u5f00\u53d1\u6846\u67b6\u3002Cordova\u662f\u4e00\u4e2a\u8de8\u5e73<\/p>\n

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

\u53f0\u7684\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u6846\u67b6\uff0c\u5b83\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u6765\u6784\u5efa\u9002\u7528\u4e8e\u4e0d\u540c\u5e73\u53f0\u7684\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u4e0b\u9762\u662f\u6253\u5305\u548c\u8fd0\u884cHTML5\u5e94\u7528\u7a0b\u5e8f\u5728iOS\u4e0a\u7684\u8be6\u7ec6\u4ecb\u7ecd\u548c\u539f\u7406\uff1a<\/p>\n

1. \u5b89\u88c5Cordova\uff1a\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Cordova\u7684\u5f00\u53d1\u73af\u5883\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Cordova\uff1a<\/p>\n

“`shell<\/p>\n

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

“`<\/p>\n

2. \u521b\u5efaCordova\u9879\u76ee\uff1a\u5728\u7ec8\u7aef\u4e0a\uff0c\u5207\u6362\u5230\u60a8\u8981\u521b\u5efa\u9879\u76ee\u7684\u76ee\u5f55\uff0c\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Cordova\u9879\u76ee\uff1a<\/p>\n

“`shell<\/p>\n

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

“`<\/p>\n

\u5176\u4e2d\uff0c`myapp`\u662f\u9879\u76ee\u7684\u540d\u79f0\uff0c`com.exaple.myapp`\u662f\u9879\u76ee\u7684\u552f\u4e00\u6807\u8bc6\u7b26\uff08\u7c7b\u4f3c\u4e8e\u5305\u540d\uff09\uff0c`MyAPP`\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u663e\u793a\u540d\u79f0\u3002<\/p>\n

3. \u8fdb\u5165\u9879\u76ee\u76ee\u5f55\u5e76\u6dfb\u52a0iOS\u5e73\u53f0\uff1a\u5728\u7ec8\u7aef\u4e0a\uff0c\u8fdb\u5165\u60a8\u521a\u521a\u521b\u5efa\u7684\u9879\u76ee\u76ee\u5f55\uff0c\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6dfb\u52a0iOS\u5e73\u53f0\uff1a<\/p>\n

“`shell<\/p>\n

cd myapp<\/p>\n

cordova platform add ios<\/p>\n

“`<\/p>\n

4. \u7f16\u5199HTML5\u5e94\u7528\u7a0b\u5e8f\uff1a\u5728\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u627e\u5230`www`\u76ee\u5f55\u5e76\u7f16\u8f91`index.html`\u6587\u4ef6\u3002\u5728\u8fd9\u4e2a\u6587\u4ef6\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u6765\u7f16\u5199\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

5. \u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\uff1a\u5728\u7ec8\u7aef\u4e0a\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n

“`shell<\/p>\n

cordova build ios<\/p>\n

“`<\/p>\n

\u8fd9\u5c06\u5728`platforms\/ios`\u6587\u4ef6\u5939\u4e0b\u751f\u6210Xcode\u9879\u76ee\u6587\u4ef6\u3002<\/p>\n

6. \u6253\u5f00Xcode\u9879\u76ee\uff1a\u5728\u7ec8\u7aef\u4e0a\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u6253\u5f00Xcode\u9879\u76ee\uff1a<\/p>\n

“`shell<\/p>\n

open platforms\/ios\/MyAPP.xcworkspace<\/p>\n

“`<\/p>\n

\u5728Xcode\u4e2d\uff0c\u60a8\u53ef\u4ee5\u8fdb\u884c\u8fdb\u4e00\u6b65\u7684\u914d\u7f6e\uff0c\u5982\u5e94\u7528\u7a0b\u5e8f\u56fe\u6807\u3001\u542f\u52a8\u753b\u9762\u3001\u5e94\u7528\u7a0b\u5e8f\u6743\u9650\u7b49\u3002<\/p>\n

7. \u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff1a\u5728Xcode\u4e2d\uff0c\u9009\u62e9\u60a8\u8981\u8fd0\u884c\u7684\u6a21\u62df\u5668\u6216\u8fde\u63a5\u5230\u7684\u8bbe\u5907\uff0c\u5e76\u70b9\u51fb”Run”\u6309\u94ae\u6765\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u4ee5\u4e0ahtml\u5217\u8868\u6253\u5305\u540e\u5728ios\u4e0a<\/a>\u5c31\u662f\u5c06HTML5\u5e94\u7528\u7a0b\u5e8f\u6253\u5305\u5e76\u5728iOS\u4e0a\u8fd0\u884c\u7684\u8be6\u7ec6\u8fc7\u7a0b\u3002\u901a\u8fc7\u4f7f\u7528Cordova\u5f00\u53d1\u6846\u67b6\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06HTML5\u5e94\u7528\u7a0b\u5e8f\u8f6c\u6362\u4e3a\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5728iOS\u5e73\u53f0\u4e0a\u8fdb\u884c\u90e8\u7f72\u548c\u8fd0\u884c\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u5728\u4e0d\u5b66\u4e60\u79fb\u52a8\u5f00\u53d1\u7684\u7279\u5b9a\u8bed\u8a00\u548c\u6846\u67b6\u7684\u60c5\u51b5\u4e0b\uff0c\u5229\u7528\u4ed6\u4eec\u5bf9HTML\u3001CSS\u548cJavaScript\u7684\u719f\u6089\u6765\u6784\u5efa\u8de8\u5e73\u53f0\u7684\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

HTML5\u662f\u4e00\u79cd\u7528\u4e8e\u6784\u5efa\u7f51\u9875\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u6807\u51c6\u5316\u6280\u672f\u3002\u5b83\u901a\u8fc7\u4f7f\u7528HTML\u3001CSS\u548cJavaScript\u6765\u521b\u5efa\u4ea4\u4e92\u6027\u4e30\u5bcc\u7684\u7f51\u9875\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5728\u8fc7\u53bb\uff0cHTML5\u4e3b\u8981\u7528\u4e8e\u5728Web\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\uff0c\u4f46\u73b0\u5728\uff0c\u6211\u4eec\u4e5f\u53ef<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[9851,9850,12,2263,23],"topic":[],"class_list":{"0":"post-5228","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-appkf","7":"tag-ios","9":"tag-12","10":"tag-2263","11":"tag-23"},"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5228","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=5228"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/5228\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=5228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=5228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=5228"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=5228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}