【iPhoneアプリ開発記】それでも実機でテストできないー「A vaild provisioning profile matching the application’s Identifier」の対処方法


「Valid signing identity not found」を解消して、さて実機でテストするかーとビルドしてみると今度は「A vaild provisioning profile matching the application’s Identifier」が発生してビルドも通らないという事態に。
シミュレーターではビルド通るのになんでiPhoneだとビルド通らないんだっ・・・!
手順1.iOS Provisioning Centerで検証機の登録
iOSアプリを実機で動かすには検証機をウェブで登録する必要があるみたい。(必要性はよくわかりませんし、AppleIDと上手く連携してくださいよと言いたいところですが。)では、早速。まずは「iOS Provisioning Center」にアクセスします。
iOS Appsの「Devices」をクリックします。

「+」アイコンをクリック。

「Name」に適当なデバイス名を入力します。「UDID」は端末ごとに割り振られるIDを入力します。

「UDID」を確認するには、まずXcodeのメニューバーにある「Window」→「Organizer」をクリック。

Organizerにて検証したいデバイスをクリックして、Identifierをコピーします。これがUDIDになります。

「Name」と「UDID」を入力して「Continue」をクリック。

「Register」をクリックすると検証機の登録は完了です。

手順2.アプリケーションID(App ID)を登録
次はAppIDの登録です。「Identifiers」の「App IDs」を選択して「+」をクリック。
入力項目が多いので箇条で説明します。
・App ID Description
登録するApp IDの説明を書きます。アプリ名などパッとわかるものが良いかと思います。
・App Services
作成するアプリで利用するサービスを選択します。通知センターなどを利用する場合はチェックを入れる必要があります。データ保護のAPIを使うにはData Protectionにチェックを入れる必要があるのかな・・・?
・App ID Suffix
アプリのIDを指定します。アプリごとにApp IDを作成する場合は「Explicit App ID」を選択、複数のアプリでApp IDを使いまわす場合は「Wildcard App ID」を選択します。
例)com.hogehoge.*
入力後「Continue」をクリック→最後に「Submit」をクリックしてApp IDの登録は完了です。

手順3.Developer Provisioning ProfileをXcodeに取り込む
もうちょっと「iOS Provisioning Center」で操作します。左メニューから「Provisioning Profiles」の「All」をクリックします。Xcodeに取り込み済みのProfileを選択して「Edit」をクリック。

下の方にある「Devices」にて、先ほど登録した名前のデバイスを選択し、「Generate」をクリックします。

Provisioning Profileが生成されるのでダウンロードします。

後はダウンロードしたProvisioning Profileをダブルクリックすると、先ほど登録した情報がXcodeに取り込まれます。
無事取り込みが完了すると、デバイス名の横に表示されるアイコンが緑になり、Provisioning欄にProvisioning名が表示されます。

手順4.仕上げにProjectとTargetの設定を変更する
ここからはXcodeの操作になります。左メニューにてプロジェクトを選択して、中央のメニューで再度、プロジェクトを選択。「Build Settings」タブをクリックして「All」をクリック。「Code Signing」を以下の通り変更します。

ターゲットも同様に変更します。

これでCommand+Rすると、実機にアプリがインストールされて起動されるはずです!実機でテストするのにかなり手順がかかりますが、iPhoneやiPadで自分の作成したアプリが動いた時はちょっと感動しますね!
▼出版日は古いけど、今のところこの書籍が大活躍中!
コメントを残す