LoginSignup
7
9

More than 3 years have passed since last update.

DeployGateでiOSアプリをdeployするまでの格闘記録

Posted at

はじめに

アプリ開発において、配布の手間を格段に下げてくれるのがDeployGate(大変お世話になっております)

新しいmacを購入してから、DeployGateの利用環境を整えてなかったので、適当なXcodeプロジェクトを作成して、新規配布からデバイスの追加まで試してみようとしたところ、思いのほかハマったので忘れないように記録することにしました。
(誰かの助けになれば幸いです)

環境

ツール等 バージョン
macOS 10.14.5
Xcode 11.0

インストール

ドキュメントの通りにdgコマンドをインストールしました。
https://docs.deploygate.com/docs/cli

配布準備

配布用証明書の作成からProvisioning Profileの作成・インストールまでを行いました。
https://docs.deploygate.com/docs/export-ipa

(ページのUIは変わってますが、手順は大きく変わっていなかったです)

よし、デプロイだ

なんかConflict起こしてる?(´・ω・`)

$ dg deploy
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:2288:in `raise_if_conflicts': Unable to activate fastlane-2.131.0, because public_suffix-3.0.3 conflicts with public_suffix (~> 2.0.0), highline-2.0.2 conflicts with highline (< 2.0.0, >= 1.7.2) (Gem::ConflictError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1411:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:196:in `rescue in try_activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:193:in `try_activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:125:in `rescue in require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/deploygate-0.7.0/lib/deploygate.rb:30:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Library/Ruby/Gems/2.3.0/gems/deploygate-0.7.0/bin/dg:4:in `<top (required)>'
    from /usr/local/bin/dg:22:in `load'
    from /usr/local/bin/dg:22:in `<main>'

rubyのバージョンアップ

systemのrubyでなく、anyenvからのrbenvを使ってバージョンを管理するようにしたい!
(anyenv/rbenvの詳細はググってください)

記事編集時点では2.6.4をインストールし、gem update も実行しました。

command line toolsのアップデート

Xcodeのアップデートをしてたので、command line toolsもアップデートする必要がありました。

schemeがない...?

Xcode 11から、SwiftUIを使って作成するか/storyboardを使って作成するかの選択ができるようになりました。
せっかくなので、SwiftUIを使ってプロジェクトを作成したら、これまたdeployがうまく行かない...

Error message
undefined method `build_configuration_list' for nil:NilClass

こちらを参考にさせてもらうと、どうやらschemeがないらしい。

shareされているschemeは以下の場所にあるはず...
/path/to/PROJECT_NAME/PROJECT_NAME.xcodeproj/xcshareddata/xcschemes/xxxxxxxx.xcscheme

...と思って中身を見たら、たしかに本来あって欲しいところにxcschemeのファイルがない?!

今回は諦めて、従来通りにstoryboardを使って作成することにしました(´・ω・`)

(追記)
sharedのチェックを一度外して、もう一度付け直すと、xcschemeのファイルが作成されました。
試してないけど、多分いけるはず。

よし、もう一度デプロイだ

$ dg deploy

...(長いので省略)...

[05:12:36]: Successfully exported and compressed dSYM file
[05:12:36]: Successfully exported and signed the ipa file:
[05:12:36]: /Users/todate/Documents/workspace/Heptagon/DeployGateTest/DeployGateTest.ipa
Uploading to xxxxxxxx.........done
Name: xxxxxxxx
Owner: xxxxxxxx
Package: xxxxxxxx
Revision: 1
URL: https://deploygate.com/users/xxxxxxxx/platforms/ios/apps/xxxxxxxx

無事、Revision: 1のアップロードができました。

デバイスの追加(dg add-devices)を試す

ご自身やアプリのテスターがDeployGateに新しいiOS端末を追加すると、DeployGateから新しいUDIDをProvisioning Profileへ追加するよう通知が届きます。

dg add-devices
実行すると、自動的に登録待ちのUDID一覧を取得し、Apple Developerで登録を行い、Provisioning Profileを更新し、プロジェクトを再ビルドしたのち新しいアプリをDeployGateへアップロードします。

ホント便利...

アプリの配布ページを作って、検証用端末からQRコードを読み取り、端末のUUIDを取得できるところまで確認。

またエラー

dg add-devicesを実行して、新しいRevisionを作成しようとすると、またもやエラーが発生しました。

$ dg add-devices

Device [Name: xxxxxx - iPhone 6s Plus, UDID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
Do you want to add this device? (y/n) |y| 

Please enter your email and password for Apple Developer Center
to set up/download provisioning profile automatically so you can
export the app without any extra steps.

Note: Your password will be stored to your Keychain and never be sent to DeployGate.

Email: xxxx@xxxxxx.xx.xx
Two-factor Authentication (6 digits code) is enabled for account 'xxxx@xxxxxx.xx.xx'
More information about Two-factor Authentication: https://support.apple.com/en-us/HT204915

If you're running this in a non-interactive session (e.g. server or CI)
check out https://github.com/fastlane/fastlane/tree/master/spaceship#2-step-verification

(Input `sms` to escape this prompt and select a trusted phone number to send the code as a text message)

(You can also set the environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` to automate this)
(Read more at: https://github.com/fastlane/fastlane/blob/master/spaceship/docs/Authentication.md#auto-select-sms-via-spaceship-2fa-sms-default-phone-number)

Please enter the 6 digit code:
xxxxxx
Requesting session...
Error: can't modify frozen String

------------------------
DeployGate Error Report 

Title: can't modify frozen String
dg version: 11.0
Xcode version: 0.7.0

Stack trace:
/Users/xxxxxx/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/fastlane-2.131.0/spaceship/lib/spaceship/client.rb:811:in `force_encoding'
/Users/xxxxxx/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/fastlane-2.131.0/spaceship/lib/spaceship/client.rb:811:in `log_response'
/Users/xxxxxx/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/fastlane-2.131.0/spaceship/lib/spaceship/client.rb:846:in `block in send_request'
/Users/xxxxxx/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/fastlane-2.131.0/spaceship/lib/spaceship/client.rb:620:in `with_retry'
/Users/xxxxxx/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/fastlane-2.131.0/spaceship/lib/spaceship/client.rb:844:in `send_request'
and more ...

can't modify frozen Stringで調べてみると、どうやらfaradayに関連する記事がいろいろと見つかったので、自身の環境に何が入っているか確認。

$ gem list

*** LOCAL GEMS ***

...(省略)...

faraday (0.16.2)
faraday-cookie_jar (0.0.6)
faraday_middleware (0.13.1)

...(省略)...

問題のバージョンにヒット...
https://github.com/lostisland/faraday/pull/1039

バージョン指定で入れ直し

$ gem install faraday -v "0.15.4"
$ gem uninstall faraday -v "0.16.2"
$ gem list

*** LOCAL GEMS ***

...(省略)...

faraday (0.15.4)
faraday-cookie_jar (0.0.6)
faraday_middleware (0.13.1)

...(省略)...

再度トライ

$ dg add-devices

...(省略)...

Please enter the 6 digit code:
xxxxxx
Requesting session...
Device [Name: xxxxxxxx - iPhone 6s Plus, UDID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] successfully registered.

...(省略)...

無事、デバイスの登録が成功して、新しいRevisionが作成されました!

7
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9