{"id":11330,"date":"2023-11-13T12:00:37","date_gmt":"2023-11-13T04:00:37","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=11330"},"modified":"2023-11-13T12:00:37","modified_gmt":"2023-11-13T04:00:37","slug":"flutter-%e6%89%93%e5%8c%85ios%e5%ba%94%e7%94%a8%e6%93%8d%e4%bd%9c%e6%b5%81%e7%a8%8b%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/appkfa\/11330\/","title":{"rendered":"flutter \u6253\u5305ios\u5e94\u7528\u64cd\u4f5c\u6d41\u7a0b\u4ecb\u7ecd"},"content":{"rendered":"<p>Flutter\u662f\u4e00\u6b3e\u8de8\u5e73\u53f0\u7684\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u4f7f\u7528\u4e00\u5957\u4ee3\u7801\u540c\u65f6\u6784\u5efaiOS\u548cAndroid\u5e94\u7528\u3002\u5728\u5f00\u53d1\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5e94\u7528\u6253\u5305\u5e76\u53d1\u5e03\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u5185\u90e8\u5206\u53d1\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u6253\u5305Flutter\u5e94\u7528\u5e76\u53d1\u5e03\u5230iOS\u5e94\u7528\u5546\u5e97\u3002<\/p>\n<p>## \u539f\u7406<\/p>\n<p>Flutter\u5e94\u7528\u5728iOS\u4e0a\u7684\u6253\u5305\u8fc7\u7a0b\u4e0e\u539f\u751fiOS\u5e94\u7528\u7c7b\u4f3c\uff0c\u90fd\u662f\u5c06\u6e90\u4ee3\u7801\u7f16\u8bd1\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2aipa\u6587\u4ef6\u3002\u5177\u4f53\u7684\u6253\u5305\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p>1. \u7f16\u8bd1\u6e90\u4ee3\u7801\uff1aFlutter\u5e94\u7528\u7684\u6e90\u4ee3\u7801\u901a\u8fc7Dart\u7f16\u5199\uff0c\u9700\u8981\u5148\u5c06Dart\u4ee3\u7801\u7f16\u8bd1\u6210C++\u4ee3\u7801\uff0c\u7136\u540e\u518d\u5c06C++\u4ee3\u7801\u7f16\u8bd1\u6210iOS\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u7531Flutter SDK\u63d0\u4f9b\u7684\u5de5\u5177\u5b8c\u6210\u3002<\/p>\n<p>2. \u5904\u7406\u8d44\u6e90\u6587\u4ef6\uff1aFlutter\u5e94\u7528\u7684\u8d44\u6e90\u6587\u4ef6\uff08\u5982\u56fe\u7247\u3001\u5b57\u4f53\u7b49\uff09\u9700\u8981\u6253\u5305\u5230\u5e94\u7528\u4e2d\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u7531Flutter SDK\u63d0\u4f9b\u7684\u5de5\u5177\u5b8c\u6210\u3002<\/p>\n<p>3. \u914d\u7f6eXcode\u9879\u76ee\uff1a\u5c06\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6dfb\u52a0\u5230Xcode\u9879\u76ee\u4e2d\uff0c\u5e76\u914d\u7f6e\u5e94\u7528\u7684\u57fa\u672c\u4fe1\u606f\uff08\u5982\u5e94\u7528\u540d\u79f0\u3001\u7248\u672c\u53f7\u3001Bundle ID\u7b49\uff09\u3002<\/p>\n<p>4. \u6253\u5305\uff1a\u4f7f\u7528Xcode\u7684Archive\u529f\u80fd\u5c06\u5e94\u7528\u6253\u5305\u6210ipa\u6587\u4ef6\uff0c\u53ef\u4ee5\u9009\u62e9\u53d1\u5e03\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u4f7f\u7528\u4f01\u4e1a\u5206\u53d1\u65b9\u5f0f\u5206\u53d1\u7ed9\u5185\u90e8\u5458\u5de5\u3002<\/p>\n<p>## \u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u6253\u5305Flutter\u5e94\u7528\u5e76\u53d1\u5e03\u5230iOS\u5e94\u7528\u5546\u5e97\u3002<\/p>\n<p>### 1. \u914d\u7f6eFlutter\u73af\u5883<\/p>\n<p>\u5728\u6253\u5305Flutter\u5e94\u7528\u4e4b\u524d\uff0c\u9700\u8981\u5148\u914d\u7f6e\u597dFlutter\u73af\u5883\u3002\u53ef\u4ee5\u53c2\u8003Flutter\u5b98\u65b9\u6587\u6863\u8fdb\u884c\u5b89\u88c5\u548c\u914d\u7f6e\uff1ahttps:\/\/flutter.dev\/docs\/get-started\/install<\/p>\n<p>### 2. \u7f16\u8bd1\u6e90\u4ee3\u7801<\/p>\n<p>\u4f7f\u7528Flutter SDK\u63d0\u4f9b\u7684\u5de5<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/15\/14050311244.jpg\" \/><\/figure>\n<\/p>\n<p>\u5177\u7f16\u8bd1\u6e90\u4ee3\u7801\uff0c\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u3002\u5177\u4f53\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>flutter build ios &#8211;release<\/p>\n<p>&#8220;`<\/p>\n<p>\u8be5\u547d\u4ee4\u4f1a\u5c06Flutter\u5e94\u7528\u7684Dart\u4ee3\u7801\u7f16\u8bd1\u6210C++\u4ee3\u7801\uff0c\u7136\u540e\u518d\u5c06C++\u4ee3\u7801\u7f16\u8bd1\u6210iOS\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5e76\u751f\u6210\u4e00\u4e2aRunner.app\u6587\u4ef6\u5939\u3002<\/p>\n<p>### 3. \u5904\u7406\u8d44\u6e90\u6587\u4ef6<\/p>\n<p>\u4f7f\u7528Flutter SDK\u63d0\u4f9b\u7684\u5de5\u5177\u5c06Fl<a href=\"https:\/\/www.yimenapp.net\/dabao-4102.html\">android\u5f00\u53d1url\u6253\u5305<\/a>utter\u5e94\u7528\u7684\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u5230Runner.app\u6587\u4ef6\u5939\u4e2d\u3002\u5177\u4f53\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p>flutter build ios &#8211;release &#8211;asset-bundle-arguments=&#8211;split-debug-info=\/\/app.flx<\/p>\n<p><p>&#8220;`<\/p>\n<p>\u8be5\u547d\u4ee4\u4f1a\u5c06Flutter\u5e94\u7528\u7684\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u5230Runner.app\u6587\u4ef6\u5939\u4e2d\uff0c\u5e76\u751f\u6210\u4e00\u4e2aapp.flx\u6587\u4ef6\u3002<\/p>\n<p>### 4. \u914d\u7f6eXcode\u9879\u76ee<\/p>\n<p>\u5c06\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6dfb\u52a0\u5230Xcode\u9879\u76ee\u4e2d\uff0c\u5e76\u914d\u7f6e\u5e94\u7528\u7684\u57fa\u672c\u4fe1\u606f\u3002<\/p>\n<p>1. \u6253\u5f00Xcode\uff0c\u9009\u62e9File -&gt; New -&gt; Project\uff0c\u9009\u62e9iOS -&gt; Application -&gt; Single View App\uff0c\u70b9\u51fbNext\u3002<\/p>\n<p>2. \u586b\u5199\u5e94\u7528\u7684\u57fa\u672c\u4fe1\u606f\uff0c\u5982\u5e94\u7528\u540d\u79f0\u3001\u7ec4\u7ec7\u540d\u79f0\u3001Bundle ID\u7b49\uff0c\u70b9\u51fbNext\u3002<\/p>\n<p>3. \u9009\u62e9\u5e94\u7528\u7684\u5b58\u50a8\u4f4d\u7f6e\uff0c\u70b9\u51fbCreate\u3002<\/p>\n<p>4. \u5c06\u751f\u6210\u7684Runner.app\u6587\u4ef6\u5939\u62d6\u62fd\u5230Xcode\u9879\u76ee\u4e2d\uff0c\u9009\u62e9Copy items if needed\uff0c\u70b9\u51fbFinish\u3002<\/p>\n<p>5. \u5728Xcode\u4e2d\u9009\u62e9\u9879\u76ee\u7684Build Settings\uff0c\u627e\u5230Cod<a href=\"https:\/\/www.yimenapp.net\/dabao-4114.html\">vue \u5f00\u53d1ios\u5e94\u7528 \u751f\u6210ipa<\/a>e Signing Identity\u548cProvisioning Profile\uff0c\u9009\u62e9\u5bf9\u5e94\u7684\u8bc1\u4e66\u548c\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<p>6. \u5728Xcode\u4e2d\u9009\u62e9\u9879\u76ee\u7684Build Phases\uff0c\u70b9\u51fb\u201c+\u201d\uff0c\u9009\u62e9New Run Script Phase\uff0c\u8f93\u5165\u4ee5\u4e0b\u811a\u672c\uff1a<\/p>\n<p>&#8220;`<\/p>\n<p># This script gets the absolute path to the current directory<\/p>\n<p>DIR=&#8221;$( cd &#8220;$( dirname &#8220;${BASH_SOURCE[0]}&#8221; )&#8221; &gt;\/dev\/null 2&gt;&amp;1 &amp;&amp; pwd )&#8221;<\/p>\n<p># This script sets the absolute path to the Flutter app bundle<\/p>\n<p>FLUTTER_APP_BUNDLE=&#8221;$DIR\/Runner.app&#8221;<\/p>\n<p># This script sets the absolute path to the app.flx file<\/p>\n<p>FLUTTER_APP_FLX=&#8221;$DIR\/Runner.app\/app.flx&#8221;<\/p>\n<p># This script sets the absolute path to the output IPA file<\/p>\n<p>IPA_OUTPUT_FILE=&#8221;$DIR\/Runner.ipa&#8221;<\/p>\n<p># This script packages the app bundle and the app.flx file into an IPA file<\/p>\n<p>xcrun ditto -c -k &#8211;sequesterRsrc &#8211;keepParent &#8220;$FLUTTER_APP_BUNDLE&#8221; &#8220;$IPA_OUTPUT_FILE&#8221;<\/p>\n<p>xcrun ditto -c -k &#8211;sequesterRsrc &#8211;keepParent &#8220;$FLUTTER_APP_FLX&#8221; &#8220;$IPA_OUTPUT_FILE\/Payload\/Runner.app\/app.flx&#8221;<\/p>\n<p>&#8220;`<\/p>\n<p>\u8be5\u811a\u672c\u5c06\u751f\u6210\u4e00\u4e2aIPA\u6587\u4ef6\uff0c\u5305\u542b\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u3002<\/p>\n<p>### 5. \u6253\u5305\u5e76\u53d1\u5e03<\/p>\n<p>\u4f7f\u7528Xcode\u7684Archive\u529f\u80fd\u5c06\u5e94\u7528\u6253\u5305\u6210ipa\u6587\u4ef6\uff0c\u53ef\u4ee5\u9009\u62e9\u53d1\u5e03\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u4f7f\u7528\u4f01\u4e1a\u5206\u53d1\u65b9\u5f0f\u5206\u53d1\u7ed9\u5185\u90e8\u5458\u5de5\u3002\u5177\u4f53\u64cd\u4f5c\u5982\u4e0b\uff1a<\/p>\n<p>1. \u5728Xcode\u4e2d\u9009\u62e9Product -&gt; Archive\u3002<\/p>\n<p>2. \u7b49\u5f85\u6253\u5305\u5b8c\u6210\u540e\uff0c\u9009\u62e9Distribute App\u3002<\/p>\n<p>3. \u9009\u62e9\u53d1\u5e03\u65b9\u5f0f\uff08\u5982App Store Connect\u6216Enterprise\uff09\uff0c\u586b\u5199\u76f8\u5e94\u7684\u4fe1\u606f\uff0c\u70b9\u51fbNext\u3002<\/p>\n<p>4. \u9009\u62e9\u8bc1\u4e66\u548c\u914d\u7f6e\u6587\u4ef6\uff0c\u70b9\u51fbNext\u3002<\/p>\n<p>5. \u70b9\u51fbExport\uff0c\u9009\u62e9\u8f93\u51fa\u8def\u5f84\uff0c\u70b9\u51fbExport\u3002<\/p>\n<p>6. \u5c06\u751f\u6210\u7684ipa\u6587\u4ef6\u4e0a\u4f20\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u4f7f\u7528\u4f01\u4e1a\u5206\u53d1\u65b9\u5f0f\u5206\u53d1\u7ed9\u5185\u90e8\u5458\u5de5\u3002<\/p>\n<p>## \u603b\u7ed3<\/p>\n<p>Flutter\u5e94\u7528\u5728iOS\u4e0a\u7684\u6253\u5305\u8fc7\u7a0b\u4e0e\u539f\u751fiOS\u5e94\u7528\u7c7b\u4f3c\uff0c\u9700\u8981\u5148\u7f16\u8bd1\u6e90\u4ee3\u7801\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u5c06\u53ef\u6267\u884c\u6587\u4ef6\u548c\u8d44\u6e90\u6587\u4ef6\u6253\u5305\u6210ipa\u6587\u4ef6\u3002\u5728\u914d\u7f6eXcode\u9879\u76ee\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u9009\u62e9\u6b63\u786e\u7684\u8bc1\u4e66\u548c\u914d\u7f6e\u6587\u4ef6\u3002\u6253\u5305\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u9009\u62e9\u53d1\u5e03\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u4f7f\u7528\u4f01\u4e1a\u5206\u53d1\u65b9\u5f0f\u5206\u53d1\u7ed9\u5185\u90e8\u5458\u5de5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Flutter\u662f\u4e00\u6b3e\u8de8\u5e73\u53f0\u7684\u79fb\u52a8\u5e94\u7528\u5f00\u53d1\u6846\u67b6\uff0c\u53ef\u4ee5\u8ba9\u5f00\u53d1\u8005\u4f7f\u7528\u4e00\u5957\u4ee3\u7801\u540c\u65f6\u6784\u5efaiOS\u548cAndroid\u5e94\u7528\u3002\u5728\u5f00\u53d1\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5e94\u7528\u6253\u5305\u5e76\u53d1\u5e03\u5230\u5e94\u7528\u5546\u5e97\u6216\u8005\u5185\u90e8\u5206\u53d1\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u6253\u5305Flutte<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[407,18467,18466,81,718],"topic":[],"class_list":["post-11330","post","type-post","status-publish","format-standard","hentry","category-appkfa","tag-407","tag-apk","tag-ios","tag-81","tag-718"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/11330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=11330"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/11330\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=11330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=11330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=11330"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=11330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}