Skip to content

SharedPreferences写入有时候没有生效 #12

Open

Description

@LinkZhang

发现有的手机环境切换没有生效,后来发现SharedPreferences的写入操作用的是apply(),这个方法是异步的,所有存在写入没有完成,就回调onEnvironmentChange方法,建议改成commit()方法,执行成功再回调

Activity

  1. CodeXiaoMai commented on Dec 12, 2018

    @CodeXiaoMai
    Owner

    我在下个版本改一下

  2. added a commit that references this issue on Dec 12, 2018
  3. CodeXiaoMai commented on Dec 12, 2018

    @CodeXiaoMai
    Owner

    问题已经修复,请使用最新版本

  4. LinkZhang commented on Dec 13, 2018

    @LinkZhang
    Author

    commit()有返回值,判断下返回值比较好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions