Fastlane Gym 配置 Ad Hoc Distribution

Posted

技术标签:

【中文标题】Fastlane Gym 配置 Ad Hoc Distribution【英文标题】:Fastlane Gym configuration Ad Hoc Distribution 【发布时间】:2017-07-26 04:26:51 【问题描述】:

我想为我的项目设置 fastlane。我的工作区中很少有目标(应用程序、watchkit 应用程序和 watchkit 扩展程序)以及一些第三方项目。

我的问题是,当我使用 fastlane 上传构建时,我无法从 crashlytics 下载构建,但是当我手动归档构建时可以做到。

这是我的快车道

lane :beta do

sh 'bash ./update_version.sh'

gym(scheme: "MyApp", 
  workspace: "MyApp.xcworkspace",
  configuration: "Ad Hoc Distribution")

crashlytics(
  api_token: "d543d4a5b27009b...",
  build_secret: "fafb26aa69fa...",
  groups:"myapp-team",
  notifications: true
)
end

我为gym添加配置属性,因为它默认使用Release,并且我想使用Ad Hoc配置进行分发,因为所有Ad Hoc配置文件都在此配置中设置。

据我了解,带有配置属性的gym 命令将为工作区内的所有目标和项目设置临时配置。对吧?

我试图模拟 fastlane 的功能,并在所有目标和项目的方案中手动设置 Atchive -> Build Configuration -> Ad Hoc 并存档我的项目。之后,我将此存档上传到 crashlytics 并能够下载此构建。所以,我的个人资料很好,其中包括我的设备。

如何检查设置 fastlane 以使用完全相同的配置/配置文件?

谢谢。

UPD

另外一项检查,应该有助于了解一些细节。

我使用 Xcode 归档项目,然后创建 IPA 文件并从 fabric 的文档运行此命令 - https://docs.fabric.io/apple/beta/build-tools.html

/path/to/Crashlytics.framework/submit API_KEY BUILD_SECRET \
-ipaPath path.to/my.ipa \
-groupAliases my-team \
-notifications YES

之后我就可以下载构建版本了。

感谢来自 fastlane 的 Todd。

UPD 2

这是我的 fastlane 输出的最后一部分

...
Copying myapp/Resources/sound/connection_found.wav
[09:33:52]: ▸ Copying myapp/Resources/sound/connection_lost.wav
[09:33:52]: ▸ Copying myapp.strings
[09:33:52]: ▸ Copying myapp/Resources/sound/kicked.wav
[09:33:56]: ▸ Processing myapp-Info.plist
[09:33:56]: ▸ Generating 'myapp.app.dSYM'
[09:33:59]: ▸ Copying /Users/evgeniitrapeznikov/Library/Developer/Xcode/DerivedData/myapp-dfrdqdmlsgvypadklcuzikqgrnzs/Build/Intermediates/ArchiveIntermediates/myapp/BuildProductsPath/Ad\ Hoc\ Distribution-iphoneos/myapp\ WatchKit\ Extension.appex
[09:33:59]: ▸ skipping copy phase strip, binary is code signed: /Users/evgeniitrapeznikov/Library/Developer/Xcode/DerivedData/myapp-dfrdqdmlsgvypadklcuzikqgrnzs/Build/Intermediates/ArchiveIntermediates/myapp/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/myapp WatchKit Extension.appex/myapp WatchKit App.app/_WatchKitStub/WK
[09:33:59]: ▸ skipping copy phase strip, binary is code signed: /Users/evgeniitrapeznikov/Library/Developer/Xcode/DerivedData/myapp-dfrdqdmlsgvypadklcuzikqgrnzs/Build/Intermediates/ArchiveIntermediates/myapp/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/myapp WatchKit Extension.appex/myapp WatchKit App.app/myapp WatchKit App
[09:33:59]: ▸ skipping copy phase strip, binary is code signed: /Users/evgeniitrapeznikov/Library/Developer/Xcode/DerivedData/myapp-dfrdqdmlsgvypadklcuzikqgrnzs/Build/Intermediates/ArchiveIntermediates/myapp/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/myapp WatchKit Extension.appex/myapp WatchKit Extension
[09:33:59]: ▸ Running script 'Run Script'
[09:33:59]: ▸ Touching myapp.app
[09:33:59]: ▸ Signing /Users/evgeniitrapeznikov/Library/Developer/Xcode/DerivedData/myapp-dfrdqdmlsgvypadklcuzikqgrnzs/Build/Intermediates/ArchiveIntermediates/myapp/InstallationBuildProductsLocation/Applications/myapp.app
[09:34:00]: ▸ Touching myapp.app.dSYM
[09:34:00]: ▸ Archive Succeeded
[09:34:00]: Generated plist file with the following values:
[09:34:00]: ▸ -----------------------------------------
[09:34:00]: ▸ 
[09:34:00]: ▸   "method": "app-store",
[09:34:00]: ▸   "uploadSymbols": true,
[09:34:00]: ▸   "uploadBitcode": false
[09:34:00]: ▸ 
[09:34:00]: ▸ -----------------------------------------
[09:34:00]: $ /usr/bin/xcrun /Users/evgeniitrapeznikov/.fastlane/bin/bundle/lib/ruby/gems/2.2.0/gems/fastlane-2.48.0/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh -exportArchive -exportOptionsPlist '/var/folders/z7/3krkc5211ng2c090_qhd2tlm0000gn/T/gym_config20170726-23446-a2yb0t.plist' -archivePath /Users/evgeniitrapeznikov/Library/Developer/Xcode/Archives/2017-07-26/myapp\ 2017-07-26\ 09.32.18.xcarchive -exportPath '/var/folders/z7/3krkc5211ng2c090_qhd2tlm0000gn/T/gym_output20170726-23446-hafxer'
[09:34:08]: Compressing 2 dSYM(s)
[09:34:08]: $ cd '/Users/evgeniitrapeznikov/Library/Developer/Xcode/Archives/2017-07-26/myapp 2017-07-26 09.32.18.xcarchive/dSYMs' && zip -r '/Users/evgeniitrapeznikov/Desktop/myapp/myapp-ios-client/myapp.app.dSYM.zip' *.dSYM
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/ (stored 0%)
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/Contents/ (stored 0%)
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/Contents/Info.plist (deflated 51%)
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/Contents/Resources/ (stored 0%)
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/Contents/Resources/DWARF/ (stored 0%)
[09:34:09]: ▸ updating: myapp WatchKit Extension.appex.dSYM/Contents/Resources/DWARF/myapp WatchKit Extension (deflated 64%)
[09:34:09]: ▸ updating: myapp.app.dSYM/ (stored 0%)
[09:34:09]: ▸ updating: myapp.app.dSYM/Contents/ (stored 0%)
[09:34:09]: ▸ updating: myapp.app.dSYM/Contents/Info.plist (deflated 52%)
[09:34:09]: ▸ updating: myapp.app.dSYM/Contents/Resources/ (stored 0%)
[09:34:09]: ▸ updating: myapp.app.dSYM/Contents/Resources/DWARF/ (stored 0%)
[09:34:09]: ▸ updating: myapp.app.dSYM/Contents/Resources/DWARF/myapp (deflated 69%)

[09:34:09]: Successfully exported and compressed dSYM file
[09:34:09]: Successfully exported and signed the ipa file:
[09:34:09]: /Users/evgeniitrapeznikov/Desktop/myapp/myapp-ios-client/myapp.ipa
[09:34:09]: -------------------------
[09:34:09]: --- Step: crashlytics ---
[09:34:09]: -------------------------
[09:34:09]: Uploading the build to Crashlytics Beta. Time for some ☕️.
[09:34:26]: Build successfully uploaded to Crashlytics Beta ????
[09:34:26]: Visit https://fabric.io/_/beta to add release notes and notify testers.
[09:34:26]: -------------------
[09:34:26]: --- Step: slack ---
[09:34:26]: -------------------
[09:34:28]: Successfully sent Slack notification

+------+---------------------+-------------+
|             fastlane summary             |
+------+---------------------+-------------+
| Step | Action              | Time (in s) |
+------+---------------------+-------------+
| 1    | Verifying required  | 0           |
|      | fastlane version    |             |
| 2    | default_platform    | 0           |
| 3    | bash                | 0           |
|      | ./update_version.sh |             |
| 4    | gym                 | 118         |
| 5    | crashlytics         | 16          |
| 6    | slack               | 1           |
+------+---------------------+-------------+

[09:34:28]: fastlane.tools finished successfully ????

【问题讨论】:

我刚刚添加了具有以下 3 种配置的健身房。它工作正常。它完美地上传到曲棍球应用程序。 export_method: "ad-hoc", output_directory: "./Hockeybuild", scheme: Array Of BundleId 感谢来自 Fabric/fastlane 的 Eugene,Todd。如果您手动设置配置文件,您能告诉我吗?通常这种类型的问题是由签名时使用的错误配置文件引起的。您能否提供运行 Crashlytics 操作以上传 beta 版本的完整输出。另外,如果您在此处看到与提交脚本相同的问题,请告诉我:docs.fabric.io/apple/beta/build-tools.html? @ToddBurner 感谢您在这里发表评论。我了解错误配置文件中的问题。是的,我手动设置了所有配置文件(没有选中自动管理签名)。你想让我在 xcode 中存档项目,然后创建 IPA 文件并在终端中运行这个脚本吗?或者我应该使用 sh 命令将其添加为 fastlane 中的步骤? @ToddBurner 我用 xcode 存档了它,并用你的链接中的命令发送它。构建可供下载。详情请看我的更新。 @ToddBurner 刚刚从 fastlane 添加了日志。希望,这有帮助 【参考方案1】:

我刚刚将export_method: "ad-hoc" 添加到健身房,它可以工作。

【讨论】:

以上是关于Fastlane Gym 配置 Ad Hoc Distribution的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Fastlane 中更改构建配置 - 通过 gym、build _app 或 xcodebuild

将内部版本号传递给 Fastlane/Gym 中的 xcargs

将 fastlane/gym 与 xcode build 进行比较

如何在现有的 Ad-Hoc 配置文件中添加新设备?

初始化我的新 AD-HOC 配置文件以测试生产中的推送通知

用于 Ad-Hoc 分发的 Xcode 6 GM 配置文件