{"id":19674,"date":"2024-03-26T12:33:03","date_gmt":"2024-03-26T04:33:03","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=19674"},"modified":"2024-03-26T12:33:03","modified_gmt":"2024-03-26T04:33:03","slug":"ios%e4%b8%80%e9%94%ae%e6%89%93%e5%8c%85%e5%b9%b6%e4%b8%8a%e4%bc%a0%e8%92%b2%e5%85%ac%e8%8b%b1%e8%a6%81%e6%80%8e%e4%b9%88%e5%81%9a","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/19674\/","title":{"rendered":"ios\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u8981\u600e\u4e48\u505a?"},"content":{"rendered":"

iOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u662f\u4e00\u79cd\u7b80\u5316\u5f00\u53d1\u6d41\u7a0b\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u6253\u5305\u5e94\u7528\u5e76\u4e0a\u4f20\u5230\u84b2\u516c\u82f1\u5e73\u53f0\u8fdb\u884c\u6d4b\u8bd5\u6216\u53d1\u5e03\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdiOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u7684\u539f\u7406\u548c\u6b65\u9aa4\u3002<\/p>\n

\u539f\u7406\u4ecb\u7ecd:<\/p>\n

iOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u7684\u539f\u7406\u662f\u901a\u8fc7\u4f7f\u7528\u547d\u4ee4\u884c\u5de5\u5177xcodebuild\u548cxcrun\u6765\u81ea\u52a8\u5316\u6253\u5305\u548c\u5bfc\u51faIPA\u6587\u4ef6\uff0c\u7136\u540e\u5229\u7528<\/p>\n

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

\u84b2\u516c\u82f1\u7684API\u63a5\u53e3\u5b9e\u73b0\u81ea\u52a8\u4e0a\u4f20\u529f\u80fd\u3002<\/p>\n

\u6b65\u9aa4\u4ecb\u7ecd:<\/p>\n

1. \u51c6\u5907\u5de5\u4f5c<\/p>\n

– \u5728\u84b2\u516c\u82f1\u5e73\u53f0\u6ce8\u518c\u8d26\u53f7\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u5e94\u7528\u3002<\/p>\n

– \u5728\u84b2\u516c\u82f1\u5e73\u53f0\u83b7\u53d6\u5e94\u7528\u7684API Key\u3002<\/p>\n

2. \u914d\u7f6e\u9879\u76ee<\/p>\n

– \u5728\u9879\u76ee\u7684Build Settings\u4e2d\u914d\u7f6e\u597d\u8bc1\u4e66\u548c\u63cf\u8ff0\u6587\u4ef6\u7b49\u5fc5\u8981\u7684\u4fe1\u606f\u3002<\/p>\n

– \u5728\u9879\u76ee\u7684Build Phases\u4e2d\u6dfb\u52a0\u4e00\u4e2aRun Script\uff0c\u7528\u4e8e\u81ea\u52a8\u5316\u6253\u5305\u548c\u4e0a\u4f20\u7684\u811a\u672c\u3002<\/p>\n

3. \u7f16\u5199\u6253\u5305\u811a\u672c<\/p>\n

ios\u591a\u73af\u5883\u6253\u5305<\/a><\/p>\n

\u5728Run Script\u4e2d\u7f16\u5199\u81ea\u52a8\u5316\u6253\u5305\u548c\u4e0a\u4f20\u7684\u811a\u672c\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u811a\u672c\uff1a<\/p>\n

“`shell<\/p>\n

#!\/bin\/bash<\/p>\n<\/p>\n

# \u751f\u6210\u5f53\u524d\u65f6\u95f4\u4f5c\u4e3a\u5305\u540d<\/p>\n

DATE=$(date +%Y%m%d%H%M%S)<\/p>\n

OUTPUT_DIR=~\/Desktop<\/p>\n

OUTPUT_IPA_NAME=Demo_${DATE}.ipa<\/p>\n

# \u6e05\u9664\u7f13\u5b58<\/p>\n

xcodebuild clean -workspace Demo.xcworkspace -scheme Demo -configuraios\u4e00\u952e\u81ea\u52a8\u7f16\u8bd1\u6253\u5305\u63d0\u4ea4<\/a>tion Release<\/p>\n

# \u6253\u5305<\/p>\n

xcodebuild -workspace Demo.xcworkspace -scheme Demo -configuration Release -archivePath ${OUTPUT_DIR}\/Demo.xcarchive archive<\/p>\n

# \u5bfc\u51faIPA\u6587\u4ef6<\/p>\n

xcodebuild -exportArchive -archivePath ${OUTPUT_DIR}\/Demo.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath ${OUTPUT_DIR} -allowProvisioningUpdates<\/p>\n

# \u4e0a\u4f20\u5230\u84b2\u516c\u82f1<\/p>\n

curl -F “file=@${OUTPUT_DIR}\/${OUTPUT_IPA_NAME}” -F “_api_key=Your_API_Key” https:\/\/www.pgyer.com\/apiv2\/app\/upload<\/p>\n

“`<\/p>\n

\u5728\u793a\u4f8b\u811a\u672c\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u751f\u6210\u4e00\u4e2a\u5f53\u524d\u65f6\u95f4\u4f5c\u4e3a\u5305\u540d\uff0c\u7136\u540e\u6307\u5b9a\u8f93\u51fa\u76ee\u5f55\u548c\u8f93\u51faIPA\u6587\u4ef6\u7684\u540d\u79f0\u3002\u63a5\u4e0b\u6765\u6267\u884c\u6253\u5305\u548c\u5bfc\u51fa\u7684\u547d\u4ee4\uff0c\u4f7f\u7528xcodebuild\u547d\u4ee4\u8fdb\u884c\u6253\u5305\u548c\u5bfc\u51fa\u64cd\u4f5c\u3002\u6700\u540e\u4f7f\u7528curl\u547d\u4ee4\u5c06IPA\u6587\u4ef6\u4e0a\u4f20\u5230\u84b2\u516c\u82f1\u5e73\u53f0\u3002<\/p>\n

\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n

– Demo.xcworkspace\u548cDemo\u5206\u522b\u4e3a\u9879\u76ee\u7684workspace\u548cscheme\u540d\u79f0\u3002<\/p>\n

– ExportOptions.plist\u662f\u7528\u6765\u914d\u7f6e\u5bfc\u51faIPA\u6587\u4ef6\u7684\u9009\u9879\uff0c\u53ef\u4ee5\u901a\u8fc7Xcode\u624b\u52a8\u5bfc\u51fa\u4e00\u6b21IPA\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528\u547d\u4ee4xcodebuild -exportArchive -h\u67e5\u770b\u6240\u6709\u53ef\u7528\u7684\u9009\u9879\uff0c\u5e76\u5c06\u9700\u8981\u7684\u9009\u9879\u6dfb\u52a0\u5230ExportOptions.plist\u4e2d\u3002<\/p>\n

– Your_API_Key\u4e3a\u5728\u84b2\u516c\u82f1\u5e73\u53f0\u521b\u5efa\u5e94\u7528\u65f6\u83b7\u53d6\u7684API Key\u3002<\/p>\n

4. \u8fd0\u884c\u811a\u672c<\/p>\n

\u914d\u7f6e\u597d\u811a\u672c\u540e\uff0c\u5728Xcode\u4e2d\u6784\u5efa\u9879\u76ee\u5373\u53ef\u8fd0\u884c\u811a\u672c\u3002\u811a\u672c\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u4f1a\u5728\u6307\u5b9a\u76ee\u5f55\u4e0b\u751f\u6210IPA\u6587\u4ef6\u5e76\u81ea\u52a8\u4e0a\u4f20\u5230\u84b2\u516c\u82f1\u5e73\u53f0\u3002<\/p>\n

\u603b\u7ed3:<\/p>\n

\u901a\u8fc7\u4e0a\u8ff0\u6b65\u9aa4\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0iOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u7684\u529f\u80fd\u3002\u8fd9\u6837\u53ef\u4ee5\u5927\u5927\u7b80\u5316\u5f00\u53d1\u6d41\u7a0b\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u901a\u8fc7\u81ea\u52a8\u5316\u811a\u672c\u6253\u5305\u548c\u4e0a\u4f20\uff0c\u53ef\u4ee5\u8282\u7701\u5f00\u53d1\u8005\u7684\u65f6\u95f4\u548c\u7cbe\u529b\uff0c\u540c\u65f6\u4e5f\u65b9\u4fbf\u56e2\u961f\u6210\u5458\u8fdb\u884c\u6d4b\u8bd5\u548c\u4ea4\u6d41\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

iOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u662f\u4e00\u79cd\u7b80\u5316\u5f00\u53d1\u6d41\u7a0b\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u6253\u5305\u5e94\u7528\u5e76\u4e0a\u4f20\u5230\u84b2\u516c\u82f1\u5e73\u53f0\u8fdb\u884c\u6d4b\u8bd5\u6216\u53d1\u5e03\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecdiOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2\u516c\u82f1\u7684\u539f\u7406\u548c\u6b65\u9aa4\u3002\u539f\u7406\u4ecb\u7ecd:iOS\u4e00\u952e\u6253\u5305\u5e76\u4e0a\u4f20\u84b2<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[22083,9844,21,408,855],"topic":[],"class_list":["post-19674","post","type-post","status-publish","format-standard","hentry","category-appkf","tag-h5-ios-app","tag-ios","tag-21","tag-408","tag-855"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/19674","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=19674"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/19674\/revisions"}],"predecessor-version":[{"id":19747,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/19674\/revisions\/19747"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=19674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=19674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=19674"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=19674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}