9.5 C
New York
Tuesday, March 11, 2025

Flutter App crashes on bodily iOS Gadgets when utilizing shared_preferences, however works on Android and iOS Simulator


I’m going through a difficulty the place my Flutter app works completely on Android gadgets and the iOS simulator, but it surely crashes on bodily iOS gadgets throughout runtime. The crash appears to be associated to the shared_preferences package deal, because the error logs level to shared_preferences_foundation.

Listed below are some particulars about my setup:

Flutter SDK: 3.27.1
Dart SDK: 3.6.0
shared_preferences model: I attempted 2.0.15, however the situation persists.
The app runs fantastic on the iOS simulator, but it surely crashes instantly on a bodily gadget with the next error:

php
Exception Kind: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS

The crash log references shared_preferences_foundation and the swift_getObjectType operate.

Extra particulars from the crash log:

"threads" : [
  {
    "triggered": true,
    "id": 400563,
    "threadState": {
      "x": [
        {"value": 0},
        {"value": 144115192374745649, "symbolLocation": 144115188075855873, "symbol": "type metadata for SharedPreferencesPlugin"},
        {"value": 4298889776, "symbolLocation": 0, "symbol": "type metadata for SharedPreferencesPlugin"},
        {"value": 6596501960, "symbolLocation": 0, "symbol": "swift_getObjectType"},
        ...
      ]
    }
  }
]

It’s totally laborious to breed the bug, since it is a crash on start, so it isn’t a query of code, however dependencies, I believe.

What I’ve tried to date:

  • Downgrading the shared_preferences package deal to an older model.
  • Working flutter clear and flutter pub get after each change.
  • Verifying the Data.plist and Podfile to make sure no configuration points.

Questions:

  • May this be brought on by an incompatibility between shared_preferences and the iOS model?
  • Is there a selected model of shared_preferences recognized to work nicely on bodily iOS gadgets with Flutter 3.27.1?
  • Are there extra configurations required for shared_preferences to work correctly on bodily iOS gadgets?
  • May there be a battle with different dependencies?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles