Flutterででてくる fatal error: 'location/LocationPlugin.h' file not found バグ

現状

FlutterでLyokone/locationshared_preferences とか使おうとした時に、Xcodeが以下のようなエラーを吐くことがある

GeneratedPluginRegistrant.m:6:9: fatal error: 'location/LocationPlugin.h' file not found #import <location/LocationPlugin.h>
GeneratedPluginRegistrant.m:6:9: fatal error: 'shared_preferences/SharedPreferencesPlugin.h' file not found #import <shared_preferences/SharedPreferencesPlugin.h>

悲しい

対応

強引にコードを突っ込んだら動いた。

  • 1 Headers/location をつくる
    mkdir ios/Pods/Headers/location/

  • 2 codeをコピーする
    cp ~/.pub-cache/hosted/pub.dartlang.org/location-1.1.7/ios/Classes/* ios/Pods/Headers/location/

  • 3 include pathを変更する Xcodeを開き、 Build settings -> Search Paths -> Header Search Paths
    "${PODS_ROOT}/Headers"Header Search Pathsに入れる

  • 4 動かす

備考

普通にHeaderディレクトリ作ってそこに入れたほうが良い。Pods/以下は自動生成で消える