Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shared Preferences error in Flutter - iOS on Mac

I'm trying to run Flutter app on iOS on Mac. When I'm trying to build project, it gives me this error:

Xcode's output: ↳ === BUILD TARGET shared_preferences OF PROJECT Pods WITH CONFIGURATION Debug === In file included from /Users/(username)/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.2.4/ios/Classes/SharedPreferencesPlugin.m:5: /Users/(username)/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.2.4/ios/Classes/SharedPreferencesPlugin.h:1:9: fatal error: 'Flutter/Flutter.h' file not found #import ^~~~~~~~~~~~~~~~~~~ 1 error generated. Could not build the application for the simulator.

I've tried to build it from different Flutter channels, no change.

Any idea what is wrong?

EDIT: flutter version 0.2.8 pod version 1.5.0

like image 379
Tony Danilov Avatar asked Sep 20 '25 21:09

Tony Danilov


1 Answers

https://github.com/flutter/flutter/issues/16036#issuecomment-380712094 provides instructions that seemed to have worked for others

Can I ask you to try the following:

  • make sure you have Cocoapods 1.5.0 installed (pod --version should say 1.5.0)
  • change any dependencies you have on the firebase_xxx, google_sign_in, or cloud_firestore plugins to the newest versions (look for changelog entries referring to Cocoapods 1.5.0)
  • change your ios/Podfile to the newest version on Flutter master branch (https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/cocoapods)
  • delete ios/Podfile.lock and ios/Pods switch to Flutter master branch
  • flutter clean ; flutter run
like image 52
Günter Zöchbauer Avatar answered Sep 22 '25 09:09

Günter Zöchbauer