flutter本地存储功能SharedPreferences和原生与交互是否存在冲突
flutter吧
全部回复
仅看楼主
level 1
linhwe 楼主
原来项目 SharedPreferences 正常使用,但是添加 ios 原生与交互后 SharedPreferences 就失效了,提示’Unhandled Exception: MissingPluginException (No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)’, 自己也尝试寻找原因,大概定位到是 oc 设置 rootViewController 时,如果是 rootViewController 是 flutter 界面那么跳转无法使用,SharedPreferences 可以使用,如果是 rootViewController 是 ios 原生界面,那么跳转可以使用 SharedPreferences 失效,但是没有找到解决这个不兼容的办法,希望各位大虾帮忙看看
2020年10月26日 01点10分 1
level 6
因为SharedPreferences 本地就是调用的原生代码. 你写自己的交互方法的时候用了赋写 .所以你的代码可以用,别人的方法被你覆盖了自然用不了
2020年10月26日 02点10分 2
多谢大佬答疑解惑
2020年10月26日 05点10分
1