2
0

FlutterやらないといけなくなったiOSニキ無事死亡

Posted at

Flutter? きいてないよ

プロジェクトがFlutterで作られているので、やらないといけない。
前任者は見当たらない。
ビルドスムースに通らない。

やるしかない

手順

ChatGPTにきく。以上。

ChatGPTに教えてもらった手順

FlutterSDKのインストール

以下のリンクからFlutterSDKをダウンロードする。

解凍してパスを通す。

unzip ~/Downloads/flutter_macos_arm64_3.24.3-stable.zip \
       -d ~/development/
export PATH=$HOME/development/flutter/bin:$PATH

プロジェクトの設定をする

FlutterのプロジェクトをGitHubからクローンしてくる。
プロジェクトのディレクトリに入る。

(もしくは自分で作る場合は以下で立ち上げるらしい。)

flutter create my_app

必要なFlutterパッケージをダウンロード

flutter pub get 

エラー出る。

Note: meta is pinned to version 1.15.0 by flutter from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.
Because your_app depends on flutter from sdk which depends on meta 1.15.0, meta
1.15.0 is required.

pub_spec.yamlのmetaを1.15に書き換える。

  meta: 1.15.0

もう一回

flutter pub get 

これで必要なパッケージがダウンロードされる。

次はiOSのパッケージをインストールする。
iosディレクトリとpodfileは勝手に作られているので、pod installする。

cd ios
pod install
cd ..

はい、エラー

[!] CocoaPods could not find compatible versions for pod "Sentry/HybridSDK":
In snapshot (Podfile.lock):
Sentry/HybridSDK (= 8.19.0)

In Podfile:
sentry_flutter (from .symlinks/plugins/sentry_flutter/ios) was resolved to 0.0.1, which depends on
Sentry/HybridSDK (= 8.21.0)

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • changed the constraints of dependency Sentry/HybridSDK inside your development pod sentry_flutter.
    You should run pod update Sentry/HybridSDK to apply changes you've made.

Sentry/HybridSDKとやらをアップデートします。

pod update Sentry/HybridSDK

ビルド

flutter run

エラー出ます。

Failed to build iOS app
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): Type 'UIApplication' does not conform to protocol
'Launcher'
/Users/majimadaisuke/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.5/ios/Classe
s/Launcher.swift:21:0

パッケージをアップグレードします。

flutter pub upgrade 
pod install --repo-update

再度run

flutter run

はい、エラー

Failed to build iOS app
Could not build the precompiled application for the device.
Semantic Issue (Xcode): No type named 'terminate_handler' in namespace 'std'
/Users/majimadaisuke/Downloads/workspace/hub_app/ios/Pods/Sentry/Sources/SentryC
rash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:59:12
Semantic Issue (Xcode): No member named 'set_terminate' in namespace 'std'
/Users/majimadaisuke/Downloads/workspace/my_app/ios/Pods/Sentry/Sources/SentryC
rash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:205:46
Semantic Issue (Xcode): No type named 'set_terminate' in namespace 'std'
/Users/majimadaisuke/Downloads/workspace/my_app/ios/Pods/Sentry/Sources/SentryC
rash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:207:17

sentryのバージョンをのバージョンを上げます。
pubspec.yamlのバージョンを書き換えます。

pubspec.yaml
  sentry_flutter: ^8.9.0
flutter pub get

もう一回ビルド

flutter run

エラー

Failed to build iOS app
Could not build the precompiled application for the device.
Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside
framework module 'firebase_database.FLTFirebaseDatabaseObserveStreamHandler':
'/Users/majimadaisuke/Downloads/workspace/my_app/ios/Pods/Headers/Public/Fireba
se/Firebase.h'
/Users/majimadaisuke/.pub-cache/hosted/pub.dev/firebase_database-10.2.4/ios/Clas
ses/FLTFirebaseDatabaseObserveStreamHandler.h:3:8
Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside
framework module 'firebase_database.FLTFirebaseDatabasePlugin':
'/Users/majimadaisuke/Downloads/workspace/my_app/ios/Pods/Headers/Public/Fireba
se/Firebase.h'
/Users/majimadaisuke/.pub-cache/hosted/pub.dev/firebase_database-10.2.4/ios/Clas
ses/FLTFirebaseDatabasePlugin.h:3:8
Lexical or Preprocessor Issue (Xcode): Include of non-modular header inside
framework module 'firebase_database.FLTFirebaseDatabaseUtils':
'/Users/majimadaisuke/Downloads/workspace/my_app/ios/Pods/Headers/Public/Fireba
se/Firebase.h'
/Users/majimadaisuke/.pub-cache/hosted/pub.dev/firebase_database-10.2.4/ios/Clas
ses/FLTFirebaseDatabaseUtils.h:3:8

firebase_databaseのヘッダーファイルが認識されないエラーっぽい。

Xcodeを開く→TARGETS→Runner→BuildSettingsAllow Non-modular Includes In Framework Modulesを検索→Yesに。

えいや

flutter run

やっとビルドできた。

アタマがフラッター😵‍💫

んで今からflutter/dartの書き方をChatGPT兄貴にききます。

ハッピー・コンピューティング🎵

🐣


フリーランスエンジニアです。
AIについて色々記事を書いていますのでよかったらプロフィールを見てみてください。

もし以下のようなご要望をお持ちでしたらお気軽にご相談ください。
AIサービスを開発したい、ビジネスにAIを組み込んで効率化したい、AIを使ったスマホアプリを開発したい、
ARを使ったアプリケーションを作りたい、スマホアプリを作りたいけどどこに相談したらいいかわからない…

いずれも中間コストを省いたリーズナブルな価格でお請けできます。

お仕事のご相談はこちらまで
rockyshikoku@gmail.com

機械学習やAR技術を使ったアプリケーションを作っています。
機械学習/AR関連の情報を発信しています。

X
Medium
GitHub

2
0
0

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
2
0