flutter build ipa/Class AMSupportURLConnectionDelegate is implemented in bothエラーの解消

FlutterでiOSをビルドしたらエラーが悩まされたのでメモ。

>flutter build ipa
*
*
*
Failed to build iOS app
Error output from Xcode build:
↳
   objc[48773]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x203b9c188) and ?? (0x11868c2b8). One of the two will be used. Which one is undefined.
   objc[48773]: Class AMSupportURLSession is implemented in both ?? (0x203b9c1d8) and ?? (0x11868c308). One of the two will be used. Which one is undefined.
   ** BUILD FAILED **
   *
   *
   *
   ld: warning: ignoring file /*/build/ios/Release-iphoneos/FMDB/FMDB.framework/FMDB, building for iOS-armv7 but attempting to link
   with file built for iOS-arm64
   Undefined symbols for architecture armv7:
     "_OBJC_CLASS_$_FMDatabaseQueue", referenced from:
         objc-class-ref in SqflitePlugin.o
   ld: symbol(s) not found for architecture armv7
   clang: error: linker command failed with exit code 1 (use -v to see invocation)

色々調べたところ、sqfliteのarmv7ビルドで失敗しているっぽいので、iOSのバージョンを9.0から13.0に変更してビルド出来ることを確認。

>flutter clean
>flutter build ipa # 失敗(上記エラー)
Xcode>Pods>TARGETS>sqflite>General>Development info>iOS9.0から13.0に変更
>flutter build ipa # 成功

ただ、この方法だと、flutter clean&pod install するたびに、iOS13.0から9.0に戻ってしまい、いちいちXcodeで設定し直すのが大変面倒。

更に色々調べて、Podfileを変更することでiOS13.0を固定化して解決できた。

>vi flutter_project/ios/Podfile

post_install do |installer|
 installer.pods_project.targets.each do |target|
   flutter_additional_ios_build_settings(target)
   target.build_configurations.each do |config| # 追加
     config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' # 追加
   end # 追加
 end
end

iOSがビルド出来るようになった!

>flutter clean
>flutter build ipa # 成功!

Build for ios fails : Undefined symbols for architecture armv7: · Issue #536 · tekartik/sqflite
Command CompileSwift failed with a nonzero exit code Command CompileSwift failed with a nonzero exit code ld: warning: ignoring file /Users/nastya/Dropbox/BUSIN...

お役に立てたようであればぜひ自作アプリのインストールをお願いします!

◆来期アニメ

iOS

‎来期アニメ-「来期のアニメ何観よう」を解決!
‎アニメ改編期ごとに、・来期のアニメ一覧を探す・良さそうなアニメをピックアップ・アニメ録画予約を入れるこれらの作業がいつも面倒で忘れがちなので、同じような悩みを持っている方に向けてアプリ化しました。◆「来期アニメ」一覧画面ホーム画面は、基本的に「来期アニメ」の一覧を表示します。新着順に並べてあるので追加があればすぐにわ...

Android

来期アニメ:「来期のアニメ、何観よっかな」をサポート! - Google Play のアプリ
来期スタートの新作アニメの最新情報をシンプルにお届け

コメント

タイトルとURLをコピーしました