Flutter: iOSビルドして動くようにする

動機:
アンドロイドとiosを同時に開発できるというメリットがあるので、flutterを勉強していますが、既存のプロジェクトをアンドロイドだけでなく、iosでもビルドしたいと思い、グーグルを探しながら真似してみました。

目標:flutterで作ったアプリをios端末にビルドしたい。

1.  Xcodeインストールしました。
2. /Applications/Xcode.app/Contents/Developerをアクティブなデベロッパディレクトリとして選択します

$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

3. ライセンスに同意

$ sudo xcodebuild -license


4. brewアップデート、 usbmuxd/libimobiledevice/cocoapodsインストールします

$ brew update$ brew install --HEAD usbmuxd
$ brew link usbmuxd
$ brew install --HEAD libimobiledevice
$ brew install ideviceinstaller ios-deploy cocoapods
$ pod setup
$ brew doctor

5. result: iosエミュレータでビルドできます。

6. iOS認証書の登録(なぜかiOS Developmentしかなかった。)
(iOS Development”はデバッグ用の認証書である。)

the new Xcode 11 is now automatically using certificates of types "Apple Development" and "Apple Distribution" instead of previous "iOS App Development", "iOS Distribution", "Mac Development" or "Mac App Distribution"

7. テスト用プロジェクトを開く
→ general targetバージョン修正(端末機より低く)
→ signing/Capabilitiesにteamを指定、

8. 疑問:Bundleidentifierを適当にtest.testと作成したがエラーになってしまってTest.yumemiに変更したら問題なくなりました。 (どんな問題だったのだろうか。)

9. result : Xcodeで自分の端末にビルドできます。 (端末にアプリを許可しなければならない。)

10. flutterでビルドに問題発生。

Building for iOS, but the linked and embedded framework 'App.framework' 
was built for iOS Simulator


参考:
- https://blog.thereis.xyz/67
- https://medium.com/flutter-jp/flavor-b952f2d05b5d
- https://stackoverflow.com/questions/60881764/flutter-building-for-ios-but-the-linked-and-embedded-framework-app-framework

この記事が気に入ったらサポートをしてみませんか?