やりたいこと
flutterとiPhone実機を接続してデバッグしたい。
現象
flutter run で下記。
yamato@MacBook-Pro my_app_yamato_200617a % flutter run
Launching lib/main.dart on kenichiro.yamatoのiPhone in debug mode...
════════════════════════════════════════════════════════════════════════════════
No valid code signing certificates were found
You can connect to your Apple Developer account by signing in with your Apple ID
in Xcode and create an iOS Development Certificate as well as a Provisioning
Profile for your project by:
1- Open the Flutter project's Xcode target with
open ios/Runner.xcworkspace
2- Select the 'Runner' project in the navigator then the 'Runner' target
in the project settings
3- Make sure a 'Development Team' is selected.
- For Xcode 10, look under General > Signing > Team.
- For Xcode 11 and newer, look under Signing & Capabilities > Team.
You may need to:
- Log in with your Apple ID in Xcode first
- Ensure you have a valid unique Bundle ID
- Register your device with your Apple Developer Account
- Let Xcode automatically provision a profile for your app
4- Build or run your project again
5- Trust your newly created Development Certificate on your iOS device
via Settings > General > Device Management > [your new certificate] > Trust
For more information, please visit:
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/
AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Exception: No development certificates available to code sign app for device deployment
対策
作成したflutterプロジェクトのルートにて下記を実行する。
open ios/Runner.xcworkspace
xCodeが立ち上がるので、左メニュー上のRunnerをクリックする。
Signing & Capabilities の Team に自分のAppleIDアカウントを設定する。
以上を実施してから、再度、flutter run を実行する。
途中で「キーチェーンのパスワード入力」を求められたら、Macのログインパスワードを入力する。
実機側で
「Appを検証できません」信用を確認するにはインターネット接続が必要です。
と表示された場合は、WiFiに接続した実機側で下記を実行する。
設定>一般>プロファイルとデバイス管理>デベロッパAPP
Apple Development:
をタップして「信頼」を押す。
数十秒後に「このiPhoneで信頼されています」「検証済み」と表示されたらOK。