Search code examples
xcodefluttersharedpreferencesflutter-ios

shared preferences don't work on ios [Xcode Debug]


I am trying to save the data locally in my application trying to use the shared preferences, while on android and chrome everything is ok, on ios by problems. When I debug with xcode this warning comes out "shared_preferences_ios not found".


Solution

  • Follow this steps

    1. Backup ios/Runner folder.
    2. Delete the ios folder.
    3. Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
    4. Paste your Runner backup in the ios folder (into the project).
    5. Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
    6. (If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work). Finally, flutter run and should work! If flutter run fails:
    7. cd ios
    8. pod install
    9. cd ..
    10. flutter run