LoginSignup
6
7

More than 5 years have passed since last update.

iOS の App ID の Prefix を Team ID Prefix に変更する

Posted at

iOS App ID の Prefix を Team ID Prefix に変更したい

背景

2008年頃に作成した iOS の App ID は、ランダムな ID の Prefix が付与されていた。
それは特に問題でもないのだが、Mac OS のアップグレードなどで、Keychain の移行がうまくいかなかった場合、Xcode での Archive 時にエラーとなってしまう。
そして、今回この問題に遭遇してしまい、アプリの更新ができなくなってしまった。

Technical Support Incident (TSI) で相談

もうすぐ iOS Developer Program の期限が切れると通知が届いたので、Technical Support Incident を使って iOS の App ID の Prefix の変更方法を訊ねた。2日ほどで以下の回答を得られた。

Based on your request Apple Developer Technical Support believes that your question is answered by the documentation linked here:
Technical Note TN2311
Managing Multiple App ID Prefixes

なお、TSI への相談料は年会費に含まれていて、年間2回までは無料なのだ。
ほとんど利用することがないが、プログラミング以外の問題の解決には役に立つと思う。

Prefix の変更を実施

上記 URL 内での手順を以下に引用。この指示に従って作業した。

  1. Log in to the iOS developer member center and navigate to "Certificates, Identifiers > & Profiles".
  2. Once in there, navigate into the App IDs section inside of the Identifiers section.
  3. Create a new App ID with the same wildcard bundle ID you are already using but using your Team ID based prefix as its prefix. By doing so, you will be associating your wildcard bundle ID with a new Team ID. It is okay to leave your old App ID associated with your wildcard bundle ID there and not delete it - it will be ignored going forward.
  4. Edit all your provisioning profiles that are associated to the old App ID and update them to use the new App ID.
  5. Go into all of the provisioning profiles that you have changed and regenerate them.
  6. Go into Xcode and update your provisioning profiles. For directions about how to do that, see the "Refreshing Provisioning Profiles in Xcode" section in the App Distribution Guide.
  7. Re-archive your app. Then, submit your new archive making sure to sign it with your new Team ID prefix based provisioning profile.

今回は、(Radnom ID).com.example.AppName の App ID を (Team ID).com.example.AppName に変更するのが目的である。よって、手順 3 に従い "(Team ID).com.example.*" の Team ID Prefix の Wildcard App ID を作成した。

次に、手順 4 の指示通り App Store 用 Distribution Provisioning Profile 内の App ID の項目を "(Team ID).com.example.*" に変更して保存した。

あとは、Xcode の Preferences の Accounts の画面で、"Download All Profiles" ボタンを押して、Product メニューから Archive を実行した。

以下のような警告が表示されるが、問題なく Archive したバイナリは iTunes Connect にアップロードできた。

Potential Loss of Keychain Access - The previous version of software has an application-identifier value of ['(Random ID).com.example.AppName'] and the new version of software being submitted has an application-identifier of ['(Team ID).com.example.AppName']. This will result in a loss of keychain access.

iTunes Connect のストア情報内のバイナリの application-identifier の項目も (Team ID).com.example.AppName になっていた。期待通りの結果になった。

おわりに

iOS の App ID の Prefix を変更する機会は、ほとんどないと思う。
しかし、いざ変更しようと思ったら、すぐには解決方法が分からなかった。
そのため、同じような状況に遭遇する開発者のために、備忘録も兼ねて記録しておく。

6
7
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
6
7