{"id":10021009,"date":"2025-09-23T21:23:09","date_gmt":"2025-09-23T13:23:09","guid":{"rendered":"https:\/\/itmax.cn\/?p=10021009"},"modified":"2025-09-23T21:23:09","modified_gmt":"2025-09-23T13:23:09","slug":"ios-%e4%bc%81%e4%b8%9a%e7%ad%be%e5%90%8d%e5%88%86%e5%8f%91%e5%85%a8%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10021009","title":{"rendered":"iOS \u4f01\u4e1a\u7b7e\u540d\u5206\u53d1\u5168\u6d41\u7a0b"},"content":{"rendered":"<p>\u6700\u8fd1\u5728\u505a\u5185\u90e8\u5206\u53d1\u8fd9\u5757\uff0c\u5f88\u591a\u540c\u4e8b\u5361\u5728\u51e0\u4e2a\u5730\u65b9\uff1a\u5982\u4f55\u6b63\u786e\u4ece Xcode \/ CI \u6253\u5305\u51fa enterprise <code>.ipa<\/code>\uff0c\u600e\u4e48\u751f\u6210 <code>manifest.plist<\/code>\uff0c\u628a\u4e8c\u8005\u6258\u7ba1\u5728 HTTPS \u4e0a\uff0c\u7136\u540e\u901a\u8fc7 <code>itms-services:\/\/<\/code> \u7ed9\u540c\u4e8b\u4e00\u952e\u5b89\u88c5\u3002\u4e0b\u9762\u628a\u6d41\u7a0b\u4ece\u5934\u5230\u5c3e\u8bb2\u6e05\u695a\u2014\u2014\u53e3\u8bed\u5316\u3001\u8d34\u8fd1\u5b9e\u64cd\uff0c\u5e76\u9644\u4e0a\u53ef\u8fd0\u884c\u7684 Demo\uff08Python + shell\uff09\uff0c\u80fd\u76f4\u63a5\u653e\u5230 CI \u91cc\u8dd1\u3002<\/p>\n<h2>\u5148\u628a\u6574\u4e2a\u6d41\u7a0b\u634b\u4e00\u904d<\/h2>\n<p>\u4f60\u8981\u505a\u7684\u4e8b\u5176\u5b9e\u5c31\u662f\u4e09\u4ef6\uff1a<\/p>\n<ol>\n<li>\u5728 Apple \u4f01\u4e1a\u8d26\u53f7\u91cc\u641e\u597d\u8bc1\u4e66\u548c\u63cf\u8ff0\u6587\u4ef6\uff08In-House\uff09\u3002<\/li>\n<li>\u7528 Xcode \/ xcodebuild \u628a App \u6253\u5305\u5e76\u5bfc\u51fa enterprise <code>.ipa<\/code>\u3002<\/li>\n<li>\u628a <code>.ipa<\/code> \u548c <code>manifest.plist<\/code> \u653e\u5230 HTTPS \u53ef\u8bbf\u95ee\u7684\u4f4d\u7f6e\uff08S3\/NGINX\/CloudFront\uff09\uff0c\u7136\u540e\u901a\u8fc7 <code>itms-services:\/\/?action=download-manifest&amp;url=&lt;manifest&gt;<\/code> \u7ed9\u8bbe\u5907\u5b89\u88c5\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u9762\u9010\u6b65\u628a\u6bcf\u4e00\u73af\u7684\u5b9e\u64cd\u3001\u5e38\u89c1\u5751\u3001\u4ee5\u53ca\u53ef\u8fd0\u884c\u4ee3\u7801\u7ed9\u4f60\u3002<\/p>\n<h2>\u5148\u51b3\u6761\u4ef6<\/h2>\n<ul>\n<li>\u516c\u53f8\u5fc5\u987b\u6709 Apple Enterprise Developer Program\uff08\u4f01\u4e1a\u8d26\u53f7\uff0c\u4e0d\u662f\u4e2a\u4eba\u6216\u516c\u53f8\u666e\u901a\u8d26\u53f7\uff09\u3002<\/li>\n<li>\u5f00\u53d1\u673a\u5668 \/ CI \u9700\u8981\u5b89\u88c5 Xcode\uff08\u6216\u80fd\u8dd1 xcodebuild \u7684 macOS \u673a\u5668\uff09\u3002<\/li>\n<li>\u4e00\u4e2a HTTPS \u57df\u540d\uff08\u5fc5\u987b\u662f\u53ef\u4fe1 CA \u7684 TLS\uff09\uff0c\u6216\u8005\u4f7f\u7528 S3 + CloudFront \u5e76\u7ed1\u5b9a\u8bc1\u4e66\u3002iOS \u4f1a\u62d2\u7edd\u4e0d\u53d7\u4fe1\u4efb\u8bc1\u4e66\u3002<\/li>\n<li>\u63a8\u8350\u628a\u8bc1\u4e66\u3001\u79c1\u94a5\u3001\u63cf\u8ff0\u6587\u4ef6\u7b49\u7528\u5b89\u5168\u65b9\u5f0f\u5b58\u653e\u5728 CI \u7684 secret \u7ba1\u7406\u91cc\uff0c\u4e0d\u8981\u660e\u6587\u5728\u811a\u672c\u91cc\u3002<\/li>\n<\/ul>\n<h2>\u8bc1\u4e66\u4e0e\u63cf\u8ff0\u6587\u4ef6<\/h2>\n<ol>\n<li>\n<p>\u5728 Apple \u4f01\u4e1a\u8d26\u53f7\u91cc\u521b\u5efa In-House\uff08Enterprise\uff09\u5206\u53d1\u8bc1\u4e66\uff1a<\/p>\n<ul>\n<li>\u5728\u5f00\u53d1\u8005\u8d26\u53f7\u9875\u9762 \u2192 Certificates \u2192 Add \u2192 \u9009\u62e9 \u201cIn-House and Ad Hoc\u201d \u2192 \u4e0a\u4f20 CSR\uff08Certificate Signing Request\uff09 \u2192 \u4e0b\u8f7d\u8bc1\u4e66 <code>.cer<\/code>\u3002<\/li>\n<li>\u628a\u8bc1\u4e66\u548c\u5bf9\u5e94\u79c1\u94a5\u5bfc\u5165\u5230 macOS Keychain\uff08\u6216\u5728 CI \u4e0a\u751f\u6210 <code>.p12<\/code> \u5e76\u5bfc\u5165\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u521b\u5efa App ID\uff08Bundle ID\uff09\u5e76\u751f\u6210 In-House provisioning profile\uff1a<\/p>\n<ul>\n<li>Apple Developer \u2192 Identifiers \u2192 \u65b0\u589e App ID\uff08\u5982 <code>com.example.app<\/code>\uff09\u3002<\/li>\n<li>Profiles \u2192 \u65b0\u5efa In-House Profile\uff0c\u9009\u62e9\u4e0a\u4e00\u6b65\u7684 App ID \u548c In-House \u8bc1\u4e66 \u2192 \u4e0b\u8f7d <code>.mobileprovision<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u5728\u672c\u5730\u6216 CI \u4e0a\u5bfc\u5165\u8bc1\u4e66\uff08\u793a\u4f8b\u547d\u4ee4\uff0cCI \u4e0a\u7528 secrets\uff09\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\"># \u5047\u8bbe\u4f60\u6709 base64 \u7f16\u7801\u7684 p12 \u548c\u5bc6\u7801\uff08CI secrets\uff09\necho &quot;$P12_BASE64&quot; | base64 --decode &gt; cert.p12\nsecurity create-keychain -p &quot;$KEYCHAIN_PW&quot; build.keychain\nsecurity import cert.p12 -k ~\/Library\/Keychains\/build.keychain -P &quot;$P12_PWD&quot; -T \/usr\/bin\/codesign\nsecurity list-keychains -s ~\/Library\/Keychains\/build.keychain\nsecurity unlock-keychain -p &quot;$KEYCHAIN_PW&quot; ~\/Library\/Keychains\/build.keychain\n\n# \u5141\u8bb8 codesign \u4f7f\u7528\u79c1\u94a5\uff08CI \u5e38\u89c1\u64cd\u4f5c\uff09\nsecurity set-key-partition-list -S apple-tool:,apple: -s -k &quot;$KEYCHAIN_PW&quot; ~\/Library\/Keychains\/build.keychain<\/code><\/pre>\n<blockquote><p>\u63d0\u793a\uff1a\u5982\u679c\u4e0d\u505a <code>set-key-partition-list<\/code>\uff0cCI \u4e0a <code>codesign<\/code> \u53ef\u80fd\u4f1a\u62a5\u201cnot permitted to use private key\u201d\u4e4b\u7c7b\u7684\u9519\u8bef\u3002<\/p><\/blockquote>\n<h2>\u4ece Xcode \u5bfc\u51fa enterprise IPA\uff08GUI \/ CLI \u90fd\u7ed9\u4f60\uff09<\/h2>\n<h2>GUI\uff08Xcode\uff09<\/h2>\n<ul>\n<li>\u6253\u5f00\u9879\u76ee \u2192 Product \u2192 Archive\u3002<\/li>\n<li>\u5728 Organizer \u91cc\u9009\u62e9\u65b0\u751f\u6210\u7684 archive \u2192 Distribute App \u2192 Enterprise \u2192 \u9009\u62e9\u6b63\u786e\u7684 provisioning profile \u2192 Export \u2192 \u5f97\u5230 <code>.ipa<\/code>\u3002<\/li>\n<\/ul>\n<h2>CLI\uff08xcodebuild\uff0c\u9002\u5408 CI\uff09<\/h2>\n<ol>\n<li>\u5148 archive\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\">xcodebuild -workspace MyApp.xcworkspace \/\n  -scheme MyApp \/\n  -configuration Release \/\n  -archivePath \/tmp\/MyApp.xcarchive \/\n  clean archive<\/code><\/pre>\n<ol start=\"2\">\n<li>\u7136\u540e\u5bfc\u51fa <code>.ipa<\/code>\uff0c\u9700\u8981\u4e00\u4e2a <code>exportOptions.plist<\/code>\uff0c\u793a\u4f8b\u653e\u5728\u4e0b\u9762\uff1a<br \/><code>exportOptions.plist<\/code><\/li>\n<\/ol>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-\/\/Apple Computer\/\/DTD PLIST 1.0\/\/EN&quot;\n  &quot;http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n  &lt;key&gt;method&lt;\/key&gt;\n  &lt;string&gt;enterprise&lt;\/string&gt;\n  &lt;key&gt;teamID&lt;\/key&gt;\n  &lt;string&gt;YOUR_TEAM_ID&lt;\/string&gt;\n  &lt;key&gt;provisioningProfiles&lt;\/key&gt;\n  &lt;dict&gt;\n    &lt;key&gt;com.example.myapp&lt;\/key&gt;\n    &lt;string&gt;My Enterprise Provisioning Profile Name&lt;\/string&gt;\n  &lt;\/dict&gt;\n&lt;\/dict&gt;\n&lt;\/plist&gt;<\/code><\/pre>\n<p>\u5bfc\u51fa\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"bash\">xcodebuild -exportArchive \/\n  -archivePath \/tmp\/MyApp.xcarchive \/\n  -exportOptionsPlist exportOptions.plist \/\n  -exportPath \/tmp\/MyAppExport\n# \/tmp\/MyAppExport \u4f1a\u5305\u542b MyApp.ipa<\/code><\/pre>\n<h2>Fastlane\uff08\u63a8\u8350 CI\uff09<\/h2>\n<p>\u5728 <code>Fastfile<\/code> \u4e2d\u4f7f\u7528 <code>gym<\/code>\uff08\u793a\u4f8b\uff09\uff1a<\/p>\n<pre><code class=\"ruby\">lane :enterprise_build do\n  match(type: &quot;enterprise&quot;) # \u6216\u8005\u4f7f\u7528\u624b\u52a8\u7ba1\u7406\u7684\u8bc1\u4e66\n  gym(\n    workspace: &quot;MyApp.xcworkspace&quot;,\n    scheme: &quot;MyApp&quot;,\n    export_method: &quot;enterprise&quot;,\n    export_options: {\n      provisioningProfiles: { &quot;com.example.myapp&quot; =&gt; &quot;My Enterprise Provisioning Profile Name&quot; }\n    }\n  )\nend<\/code><\/pre>\n<h2>manifest.plist\uff1a\u683c\u5f0f\u3001\u793a\u4f8b\u4e0e\u751f\u6210<\/h2>\n<p>iOS \u5185\u90e8\u5206\u53d1\u4e0d\u4f1a\u76f4\u63a5\u7528 <code>.ipa<\/code> \u94fe\u63a5\u5b89\u88c5\uff0c\u800c\u662f\u901a\u8fc7 <code>manifest.plist<\/code> \u6307\u5b9a <code>.ipa<\/code> \u7684 URL \u4e0e\u5143\u6570\u636e\u3002\u4e0b\u9762\u7ed9\u6807\u51c6\u6a21\u677f\u5e76\u9010\u5b57\u6bb5\u89e3\u91ca\u3002<\/p>\n<p><code>manifest.plist<\/code>\uff08\u793a\u4f8b\uff09<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE plist PUBLIC &quot;-\/\/Apple\/\/DTD PLIST 1.0\/\/EN&quot;\n   &quot;http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd&quot;&gt;\n&lt;plist version=&quot;1.0&quot;&gt;\n&lt;dict&gt;\n  &lt;key&gt;items&lt;\/key&gt;\n  &lt;array&gt;\n    &lt;dict&gt;\n      &lt;key&gt;assets&lt;\/key&gt;\n      &lt;array&gt;\n        &lt;dict&gt;\n          &lt;key&gt;kind&lt;\/key&gt;\n          &lt;string&gt;software-package&lt;\/string&gt;\n          &lt;key&gt;url&lt;\/key&gt;\n          &lt;string&gt;https:\/\/dl.company.com\/apps\/MyApp-1.2.3.ipa&lt;\/string&gt;\n        &lt;\/dict&gt;\n      &lt;\/array&gt;\n      &lt;key&gt;metadata&lt;\/key&gt;\n      &lt;dict&gt;\n        &lt;key&gt;bundle-identifier&lt;\/key&gt;\n        &lt;string&gt;com.example.myapp&lt;\/string&gt;\n        &lt;key&gt;bundle-version&lt;\/key&gt;\n        &lt;string&gt;1.2.3&lt;\/string&gt;\n        &lt;key&gt;kind&lt;\/key&gt;\n        &lt;string&gt;software&lt;\/string&gt;\n        &lt;key&gt;title&lt;\/key&gt;\n        &lt;string&gt;MyApp&lt;\/string&gt;\n      &lt;\/dict&gt;\n    &lt;\/dict&gt;\n  &lt;\/array&gt;\n&lt;\/dict&gt;\n&lt;\/plist&gt;<\/code><\/pre>\n<p>\u5b57\u6bb5\u8981\u70b9\u603b\u7ed3\uff1a<\/p>\n<ul>\n<li><code>url<\/code> \u5fc5\u987b\u662f HTTPS \u4e14\u80fd\u76f4\u63a5\u8bbf\u95ee <code>.ipa<\/code>\uff08\u8fd4\u56de 200\uff0c\u4e0d\u8981\u8fd4\u56de HTML \u767b\u5f55\u9875\u6216 302 \u91cd\u5b9a\u5411\uff09\u3002<\/li>\n<li><code>bundle-identifier<\/code> \u5fc5\u987b\u4e0e <code>.ipa<\/code> \u91cc <code>Info.plist<\/code> \u7684 <code>CFBundleIdentifier<\/code> \u4e00\u81f4\u3002<\/li>\n<li><code>bundle-version<\/code> \u8981\u5339\u914d <code>CFBundleShortVersionString<\/code>\uff08\u5426\u5219\u53ef\u80fd\u51fa\u73b0\u7248\u672c\u4e0d\u4e00\u81f4\u95ee\u9898\uff09\u3002<\/li>\n<\/ul>\n<h2>\u53ef\u8fd0\u884c Demo<\/h2>\n<p>Python \u811a\u672c\u81ea\u52a8\u751f\u6210 manifest.plist<\/p>\n<p>\u628a\u8fd9\u4e2a\u811a\u672c\u653e\u5230\u4f60\u7684\u673a\u5668\u6216 CI \u4e0a\u3002\u5b83\u4f1a\u628a\u4f60\u63d0\u4f9b\u7684 <code>.ipa<\/code> URL\u3001bundle id\u3001version\u3001title \u5199\u6210 <code>manifest.plist<\/code>\u3002<\/p>\n<p><code>gen_manifest.py<\/code><\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3\n&quot;&quot;&quot;\ngen_manifest.py\nGenerate manifest.plist for iOS enterprise distribution.\n\nUsage:\npython3 gen_manifest.py \/\n  --ipa-url https:\/\/dl.company.com\/apps\/MyApp-1.2.3.ipa \/\n  --bundle-id com.example.myapp \/\n  --version 1.2.3 \/\n  --title &quot;MyApp&quot; \/\n  --output manifest.plist\n&quot;&quot;&quot;\nimport argparse\nimport plistlib\nfrom pathlib import Path\n\ndef build_manifest(ipa_url: str, bundle_id: str, version: str, title: str):\n    # Build the dict matching the required plist structure\n    manifest = {\n        &quot;items&quot;: [\n            {\n                &quot;assets&quot;: [\n                    {\n                        &quot;kind&quot;: &quot;software-package&quot;,\n                        &quot;url&quot;: ipa_url\n                    }\n                ],\n                &quot;metadata&quot;: {\n                    &quot;bundle-identifier&quot;: bundle_id,\n                    &quot;bundle-version&quot;: version,\n                    &quot;kind&quot;: &quot;software&quot;,\n                    &quot;title&quot;: title\n                }\n            }\n        ]\n    }\n    return manifest\n\ndef main():\n    parser = argparse.ArgumentParser(description=&quot;Generate manifest.plist for enterprise distribution&quot;)\n    parser.add_argument(&quot;--ipa-url&quot;, required=True, help=&quot;HTTPS URL to the .ipa&quot;)\n    parser.add_argument(&quot;--bundle-id&quot;, required=True, help=&quot;Bundle ID, e.g. com.example.myapp&quot;)\n    parser.add_argument(&quot;--version&quot;, required=True, help=&quot;App version, e.g. 1.2.3&quot;)\n    parser.add_argument(&quot;--title&quot;, required=True, help=&quot;App title&quot;)\n    parser.add_argument(&quot;--output&quot;, default=&quot;manifest.plist&quot;, help=&quot;Output filename&quot;)\n    args = parser.parse_args()\n\n    manifest = build_manifest(args.ipa_url, args.bundle_id, args.version, args.title)\n    out_path = Path(args.output)\n    with out_path.open(&quot;wb&quot;) as f:\n        plistlib.dump(manifest, f)\n    print(f&quot;Generated {out_path.resolve()}&quot;)\n\nif __name__ == &quot;__main__&quot;:\n    main()<\/code><\/pre>\n<h3>\u4f7f\u7528\u793a\u4f8b<\/h3>\n<pre><code class=\"bash\">python3 gen_manifest.py \/\n  --ipa-url &quot;https:\/\/dl.company.com\/apps\/MyApp-1.2.3.ipa&quot; \/\n  --bundle-id com.example.myapp \/\n  --version 1.2.3 \/\n  --title &quot;MyApp&quot; \/\n  --output manifest.plist<\/code><\/pre>\n<p>\u811a\u672c\u4f1a\u751f\u6210 <code>manifest.plist<\/code>\uff0c\u63a5\u4e0b\u6765\u628a\u5b83\u548c <code>.ipa<\/code> \u90fd\u4e0a\u4f20\u5230 HTTPS \u670d\u52a1\uff08S3\/CloudFront \u6216\u81ea\u5efa nginx\uff09\uff0c\u7136\u540e\u62fc\u88c5\u5b89\u88c5\u94fe\u63a5\uff1a<\/p>\n<pre><code class=\"bash\">itms-services:\/\/?action=download-manifest&amp;url=https:\/\/dl.company.com\/apps\/manifest.plist<\/code><\/pre>\n<h2>CI \u96c6\u6210\u793a\u4f8b\u811a\u672c<\/h2>\n<p>CI \u96c6\u6210\u793a\u4f8b\u811a\u672c\uff08\u6253\u5305 \u2192 \u4e0a\u4f20 \u2192 \u751f\u6210 manifest \u2192 \u8f93\u51fa\u5b89\u88c5\u94fe\u63a5\uff09<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684 CI shell \u811a\u672c\uff08\u5047\u8bbe\u4f60\u5df2\u7ecf\u6709 <code>.ipa<\/code> \u5728 <code>build\/MyApp.ipa<\/code>\uff09\uff0c\u5e76\u4e14\u4f7f\u7528 AWS CLI \u4e0a\u4f20\u5230 S3\u3002\u9700\u8981\u5728 CI \u73af\u5883\u4e2d\u914d\u7f6e <code>AWS_ACCESS_KEY_ID<\/code> \/ <code>AWS_SECRET_ACCESS_KEY<\/code> \/ <code>AWS_DEFAULT_REGION<\/code>\u3002<\/p>\n<p><code>ci_publish.sh<\/code><\/p>\n<pre><code class=\"bash\">#!\/usr\/bin\/env bash\nset -euo pipefail\n\nIPA_PATH=&quot;.\/build\/MyApp.ipa&quot;\nS3_BUCKET=&quot;s3:\/\/your-bucket\/path&quot;\nDIST_BASE=&quot;https:\/\/dl.example.com\/path&quot;  # CloudFront domain or https domain to serve files\n\n# Upload .ipa\naws s3 cp &quot;$IPA_PATH&quot; &quot;${S3_BUCKET}\/MyApp-1.2.3.ipa&quot; \/\n  --acl public-read --content-type application\/octet-stream\n\n# Generate manifest locally (use python script)\npython3 gen_manifest.py \/\n  --ipa-url &quot;${DIST_BASE}\/MyApp-1.2.3.ipa&quot; \/\n  --bundle-id com.example.myapp \/\n  --version 1.2.3 \/\n  --title &quot;MyApp&quot; \/\n  --output manifest.plist\n\n# Upload manifest\naws s3 cp manifest.plist &quot;${S3_BUCKET}\/manifest.plist&quot; \/\n  --acl public-read --content-type application\/xml\n\necho &quot;Published. Install link:&quot;\necho &quot;itms-services:\/\/?action=download-manifest&amp;url=${DIST_BASE}\/manifest.plist&quot;<\/code><\/pre>\n<p>\u628a\u8fd9\u4e2a\u811a\u672c\u653e\u5230\u4f60\u7684 CI\uff08GitLab CI \/ Jenkins \/ GitHub Actions\uff09\u91cc\uff0c\u8dd1\u5b8c\u4f1a\u8f93\u51fa\u6700\u7ec8\u5b89\u88c5\u94fe\u63a5\uff0c\u53d1\u7ed9 QA \u5373\u53ef\u3002<\/p>\n<h2>\u6258\u7ba1\u5efa\u8bae\uff08S3 + CloudFront \/ nginx \u793a\u4f8b\uff09<\/h2>\n<ul>\n<li>\u63a8\u8350\u7528 S3 + CloudFront\uff1a\u7a33\u5b9a\u3001\u652f\u6301 HTTPS\uff08ACM\uff09\uff0c\u6bd4\u8f83\u7701\u5fc3\u3002\u4e0a\u4f20\u65f6\u8bbe\u7f6e <code>Content-Type<\/code>\uff1a<code>.ipa \u2192 application\/octet-stream<\/code>, <code>manifest.plist \u2192 application\/xml<\/code>\u3002<\/li>\n<li>\u81ea\u5efa nginx\uff1a\u786e\u4fdd\u542f\u7528 TLS\uff08\u53ef\u4fe1\u8bc1\u4e66\uff09\uff0c\u793a\u4f8b nginx \u914d\u7f6e\u7247\u6bb5\uff1a<\/li>\n<\/ul>\n<pre><code class=\"nginx\">server {\n    listen 443 ssl;\n    server_name dl.example.com;\n\n    ssl_certificate \/etc\/ssl\/certs\/your-cert.pem;\n    ssl_certificate_key \/etc\/ssl\/private\/your-key.pem;\n\n    location \/apps\/ {\n        root \/var\/www;\n        types {\n            application\/octet-stream ipa;\n            application\/xml plist;\n        }\n        add_header Cache-Control &quot;max-age=3600&quot;;\n    }\n}<\/code><\/pre>\n<p>\u6ce8\u610f\uff1aiOS \u5bf9\u8bc1\u4e66\u8981\u6c42\u4e25\u683c\uff0c\u4f7f\u7528\u81ea\u7b7e\u540d\u8bc1\u4e66\u901a\u5e38\u4f1a\u5931\u8d25\uff08\u9664\u975e\u8bbe\u5907\u4fe1\u4efb\u8be5 CA\uff09\uff0c\u6240\u4ee5\u4f18\u5148\u7528 Let\u2019s Encrypt \/ ACM \/\u6b63\u89c4 CA\u3002<\/p>\n<h2>\u7ec8\u7aef\u6d4b\u8bd5\u4e0e\u6545\u969c\u6392\u67e5\uff08\u6700\u5e38\u89c1\u7684\u9519\u8bef &#038; \u9a8c\u8bc1\u547d\u4ee4\uff09<\/h2>\n<ol>\n<li><strong>\u5148\u5728\u624b\u673a Safari \u6253\u5f00 manifest.plist \u94fe\u63a5<\/strong>\uff0c\u786e\u8ba4\u80fd\u8bbf\u95ee\uff08\u4f1a\u663e\u793a XML \u5185\u5bb9\uff09\u3002<\/li>\n<li><strong>curl \u9a8c\u8bc1<\/strong>\uff08\u5728\u4f60\u672c\u5730\u6216 CI \u4e0a\uff09\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\">curl -I https:\/\/dl.example.com\/path\/manifest.plist\n# \u786e\u8ba4\u8fd4\u56de 200\uff0cContent-Type: application\/xml\ncurl -I https:\/\/dl.example.com\/path\/MyApp-1.2.3.ipa\n# \u786e\u8ba4\u8fd4\u56de 200<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>\u68c0\u67e5 HTTPS \u8bc1\u4e66\u94fe<\/strong>\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\">openssl s_client -connect dl.example.com:443 -showcerts<\/code><\/pre>\n<ol start=\"4\">\n<li><strong>\u67e5\u770b\u672c\u5730\u53ef\u7528\u7684 codesign identity\uff08\u8c03\u8bd5\u7b7e\u540d\u95ee\u9898\uff09<\/strong>\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\">security find-identity -v -p codesigning<\/code><\/pre>\n<ol start=\"5\">\n<li><strong>\u68c0\u67e5 IPA \u5185\u7684 bundle id \/ version<\/strong>\uff08\u5728 macOS \u4e0a\uff09\uff1a<\/li>\n<\/ol>\n<pre><code class=\"bash\">unzip -q MyApp.ipa -d \/tmp\/myapp_unpack\nplutil -p \/tmp\/myapp_unpack\/Payload\/MyApp.app\/Info.plist\n# \u6216\u8005\u4f7f\u7528 \/usr\/libexec\/PlistBuddy\n\/usr\/libexec\/PlistBuddy -c &quot;Print :CFBundleIdentifier&quot; \/tmp\/myapp_unpack\/Payload\/MyApp.app\/Info.plist\n\/usr\/libexec\/PlistBuddy -c &quot;Print :CFBundleShortVersionString&quot; \/tmp\/myapp_unpack\/Payload\/MyApp.app\/Info.plist<\/code><\/pre>\n<p>\u786e\u8ba4\u8fd9\u4e9b\u503c\u4e0e <code>manifest.plist<\/code> \u4e2d\u4e00\u81f4\u3002<\/p>\n<ol start=\"6\">\n<li><strong>\u5e38\u89c1\u9519\u8bef\u4e0e\u542b\u4e49<\/strong>\uff1a<\/li>\n<\/ol>\n<ul>\n<li>\u201c\u672a\u80fd\u68c0\u7d22\u6e05\u5355 \/ Could not retrieve manifest\u201d \u2192 manifest URL \u4e0d\u53ef\u8bbf\u95ee \/ HTTPS \u8bc1\u4e66\u95ee\u9898 \/ \u8fd4\u56de HTML \u800c\u4e0d\u662f XML\u3002<\/li>\n<li>\u201c\u65e0\u6cd5\u5b89\u88c5\u5e94\u7528 \/ App installation failed\u201d \u2192 \u7b7e\u540d\u6216\u63cf\u8ff0\u6587\u4ef6\u95ee\u9898\uff08bundle id \u4e0e profile \u4e0d\u5339\u914d\u3001\u8bc1\u4e66\u5931\u6548\u6216\u88ab\u540a\u9500\uff09\u3002<\/li>\n<li>\u201c\u5e94\u7528\u5b89\u88c5\u540e\u95ea\u9000\u201d \u2192 \u68c0\u67e5\u5d29\u6e83\u65e5\u5fd7\uff08Xcode Devices \u7a97\u53e3\u6216 Console.app\uff09\u3002<\/li>\n<\/ul>\n<h2>\u7528\u6237\u5b89\u88c5\u4f53\u9a8c<\/h2>\n<ol>\n<li>\u7528 iPhone \u7684 Safari \u6253\u5f00 <code>itms-services:\/\/?action=download-manifest&amp;url=https:\/\/...\/manifest.plist<\/code>\uff08\u901a\u5e38\u662f\u4f60\u53d1\u7684\u4e8c\u7ef4\u7801\u6216\u5b89\u88c5\u9875\u6309\u94ae\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u5b89\u88c5\uff0c\u7cfb\u7edf\u63d0\u793a\u786e\u8ba4\uff0c\u70b9\u51fb\u5b89\u88c5\u3002<\/li>\n<li>\u5982\u679c\u662f\u8be5\u4f01\u4e1a\u8bc1\u4e66\u7b2c\u4e00\u6b21\u5728\u8bbe\u5907\u4e0a\u4f7f\u7528\uff0c\u9700\u8981\u53bb <strong>\u8bbe\u7f6e \u2192 \u901a\u7528 \u2192 \u63cf\u8ff0\u6587\u4ef6\u4e0e\u8bbe\u5907\u7ba1\u7406<\/strong>\uff08\u6216 \u201c\u8bbe\u5907\u7ba1\u7406\u201d\uff09\u91cc\u4fe1\u4efb\u8be5\u4f01\u4e1a\u8bc1\u4e66\u3002\u4f60\u6700\u597d\u5728\u5b89\u88c5\u9875\u4e0a\u5199\u8fd9\u4e2a\u6b65\u9aa4\u5e76\u914d\u56fe\u3002<\/li>\n<\/ol>\n<h2>\u5408\u89c4\u4e0e\u5b89\u5168\u63d0\u793a<\/h2>\n<ul>\n<li>Apple \u660e\u786e\u8981\u6c42\u4f01\u4e1a\u8d26\u53f7\u53ea\u7528\u4e8e\u201c\u516c\u53f8\u5185\u90e8\u5206\u53d1\u7ed9\u516c\u53f8\u5458\u5de5\u6216\u53d7\u7ba1\u7406\u8bbe\u5907\u201d\uff0c<strong>\u4e0d\u80fd\u5bf9\u5916\u516c\u5f00\u53d1\u5e03\u7ed9\u4efb\u610f\u7528\u6237<\/strong>\u3002\u6ee5\u7528\u4f1a\u88ab\u540a\u9500\u4f01\u4e1a\u8bc1\u4e66\u3002<\/li>\n<li>\u8bc1\u4e66\u4e0e\u79c1\u94a5\u8981\u8c28\u614e\u4fdd\u7ba1\u3002CI \u4e2d\u5bfc\u5165\u79c1\u94a5\u8981\u9650\u5236\u6743\u9650\uff0c\u5e76\u5b9a\u671f\u8f6e\u6362\u3002<\/li>\n<li>\u8bb0\u5f55\u6bcf\u6b21\u53d1\u5e03\u7684\u7248\u672c\u3001\u8c01\u53ef\u4ee5\u8bbf\u95ee\u3001\u8fc7\u671f\u63d0\u9192\uff0c\u5efa\u8bae\u7ed3\u5408 MDM \u7ba1\u7406\u8bbe\u5907\/\u5e94\u7528\u6743\u9650\u3002<\/li>\n<\/ul>\n<h2>\u573a\u666f\u6f14\u793a<\/h2>\n<p>\u4f01\u4e1a\u5185\u90e8\u9700\u8981\u628a\u4e00\u4e2a\u65b0\u7248\u672c\u5feb\u901f\u4e0b\u53d1\u7ed9 200 \u540d QA \u548c 10 \u53f0\u6d4b\u8bd5\u8bbe\u5907\u3002\u63a8\u8350\u6d41\u7a0b\uff1a<\/p>\n<ol>\n<li>CI\uff08Jenkins\/Fastlane\uff09\u8dd1\u5b8c\u5355\u5143\u6d4b\u8bd5\u540e\u89e6\u53d1 enterprise lane\uff1aarchive \u2192 export ipa\u3002<\/li>\n<li>CI \u4e0a\u4f20 ipa \u5230 S3 + CloudFront\uff08HTTPS\uff09\u3002<\/li>\n<li>CI \u8c03\u7528 <code>gen_manifest.py<\/code> \u751f\u6210 manifest\uff0c\u4e0a\u4f20\u5230 S3\u3002<\/li>\n<li>CI \u5728 Slack \u91cc\u53d1\u51fa\u5b89\u88c5\u94fe\u63a5\uff08itms-services\/:\/\/&#8230;\uff09\u3002<\/li>\n<li>QA \u7528\u624b\u673a\u6253\u5f00\u5e76\u5b89\u88c5\u3002\u9700\u8981\u65f6\u7ed3\u5408 MDM \u5f3a\u5236\u4e0b\u53d1\u5e76\u64a4\u56de\u3002<\/li>\n<\/ol>\n<p>\u8fd9\u6837\u65e2\u5feb\u901f\u53c8\u53ef\u63a7\uff0c\u8fd8\u80fd\u628a\u8bc1\u4e66\u7ba1\u7406\u96c6\u4e2d\u5728 CI \u7684\u5b89\u5168\u533a\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<ul>\n<li>\u5fc5\u987b\u4fdd\u8bc1\u8bc1\u4e66\u3001\u63cf\u8ff0\u6587\u4ef6\u6b63\u786e\u5e76\u5728 Keychain\/CI \u4e2d\u53ef\u7528\uff1b<\/li>\n<li><code>.ipa<\/code> \u4e0e <code>manifest.plist<\/code> \u5fc5\u987b\u901a\u8fc7\u53ef\u4fe1 HTTPS \u63d0\u4f9b\uff1b<\/li>\n<li>\u63a8\u8350\u628a manifest \u751f\u6210\u548c\u4e0a\u4f20\u653e\u8fdb CI \u6d41\u7a0b\uff1b<\/li>\n<li>\u5e38\u89c1\u95ee\u9898\u901a\u5e38\u662f\u8bc1\u4e66\u3001HTTPS\u3001manifest \u683c\u5f0f\u6216 bundle id \u4e0d\u4e00\u81f4\uff0c\u6309\u672c\u6587\u63d0\u4f9b\u7684\u547d\u4ee4\u9010\u4e00\u6392\u67e5\u5373\u53ef\uff1b<\/li>\n<li>\u5408\u89c4\u4e0a\u8981\u6ce8\u610f\u4f01\u4e1a\u7b7e\u540d\u7684\u4f7f\u7528\u8303\u56f4\u4e0e\u98ce\u9669\u3002<\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000047277199\">https:\/\/segmentfault.com\/a\/1190000047277199<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u505a\u5185\u90e8\u5206\u53d1\u8fd9\u5757\uff0c\u5f88\u591a\u540c\u4e8b\u5361\u5728\u51e0\u4e2a\u5730\u65b9\uff1a\u5982\u4f55\u6b63\u786e\u4ece Xcode \/ CI \u6253\u5305\u51fa enterprise . [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10021009","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10021009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10021009"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10021009\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10021009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10021009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10021009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}