shared_preferences 使用无法加载

来源:9-5 基于shared_preferences本地存储操作【本地存储】

mengliu

2019-03-23

老师 只要加上shared_preferences组件以后 就出错了!我已经配置了镜像 下载http组件就没有问题
packages 好像也有 shared_preferences 这个包
图片描述

写回答

3回答

CrazyCodeBoy

2019-03-26

从提供的代码上看是OK的,这是运行效果:

//img.mukewang.com/szimg/5c9a419b0001e2e600130009.jpg

你卸载APP之后重装实现呢:


0
0

mengliu

提问者

2019-03-26

老师 不是项目代码的原因,新建的项目,如果不添加shared_preferences: ^0.5.1+2插件就运行正常,添加了这个插件就跑不起来了  报错信息:

Launching lib/main.dart on iPhone X in debug mode...

Warning: CocoaPods not installed. Skipping pod install.

  CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.

  Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.

  For more info, see https://flutter.io/platform-plugins

To install:

  brew install cocoapods

  pod setup


Running Xcode build...

Xcode build done.                                           11.3s

Failed to build iOS app

Could not build the application for the simulator.

Error launching application on iPhone X.

Error output from Xcode build:

    ** BUILD FAILED **



Xcode's output:

    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===

    Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"

    Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"

    /Users/mengliu/AndroidStudioProjects/flutter_app/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'shared_preferences/SharedPreferencesPlugin.h' file not found

    #import <shared_preferences/SharedPreferencesPlugin.h>

            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    1 error generated.


0
1
CrazyCodeBoy
看回复
2019-03-26
共1条回复

CrazyCodeBoy

2019-03-25

如果还没解决的话,将这个文件的完整代码提供下,我帮你看看

0
0

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3270 问题

查看课程