4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Flutter iOSでGenerated.xcconfigが読み込めない場合の解決策

Posted at

FlutterでiOS用にFlavorを追加した際に、Schemaは正常に追加できるものの、自作のxcconfigからGenerated.xcconfigをimportしようとしたところ、xcodeでrunした際に、Generated.xcconfigが見つからない旨のエラーが出ていました。
このままでは開発環境情報をハードコーディングする羽目になってしまう、と困っていたところ、英語で解決策が乗っているサイトを見つけました。
https://www.reddit.com/r/Flutter/comments/d1otpq/different_build_configurations_in_iosxcode_wont/

「コピーは絶対するな。新しいxcconfigファイルが置かれているフォルダを確認しろ。」
ということでxcconfigが置かれているフォルダを確認したところ、一つ階層がずれていることに気づきました。
最初Flutterのバグかと思っていましたが、ただのケアレスミスでした。
これで、今の所iOSでもFlavorは十分使えるようになりました。
今後気を付けたいと思います。

Don't do that, don't copy and paste the Generated.xcconfig file because you lose important build settings like FLUTTER_BUILD_NUMBER and FLUTTER_BUILD_NAME. You'll want those.

Check to make sure your new scheme xcconfig file is in the right folder. It should be on disk in the Flutter folder. After several hours of banging my head, I noticed that my Production.xcconfig file it was NOT in the /Flutter directory, but a directory above. That's not right, and was causing the error.

I think when you right click and add a xcconfig file in XCode, it doesn't put it in the correctly directory.

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?