Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在applicationWillResignActive时保存数据,后在 applicationDidBecomeActive 读取数据,读取不出来 #1438

Open
7General opened this issue Nov 25, 2024 · 2 comments

Comments

@7General
Copy link

Note:

在applicationWillResignActive时保存数据,后在 applicationDidBecomeActive 读取数据,读取不出来

The language of MMKV

Swift

The version of MMKV

v1.0.19

The platform of MMKV

iOS

The installation of MMKV

Cocoapods

What's the issue?

private let OPBShowAppLockTimeKey = "OPBShowAppLockTimeKey"

1:首先程序进入applicationWillResignActive

func __saveAppResignActiveTime() {
        let currentTime = Date().timeIntervalSince1970
        MMKV.default().set(currentTime, forKey: OPBShowAppLockTimeKey)
        MMKV.default().sync()
    }

2:当程序进入applicationDidBecomeActive

func __getAppDidBecomectiveTime() -> TimeInterval  {
        let ss = MMKV.default().double(forKey: OPBShowAppLockTimeKey)
        return ss
    }

问题是
在调用__getAppDidBecomectiveTime 方法时,获取存不到已存入的信息。

@lingol
Copy link
Collaborator

lingol commented Nov 25, 2024

  1. That version is just too old for our support. Upgrade to the latest version first.
  2. After upgrading, if it's still not working, provide the full logs of MMKV.

@7General
Copy link
Author

ok,i will upgading the mmkv. thanks!
see you later!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants