You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New features, bugfixes, updates and other improvements are all handled mostly by @lingol in his free time.
To support @lingol , please consider 💖 sponsoring him on GitHub 💖.
Sponsored issues will be prioritized.
(If you are already a sponsor, thank you! We will get to this shortly.)
I believe the exception is crystal clear. You somehow call MMKV.default().setXXX() without enableAutoKeyExpire() first. Check the call stacks of your crash report and you will find exactly where it's called.
I believe the exception is crystal clear. You somehow call MMKV.default().setXXX() without enableAutoKeyExpire() first. Check the call stacks of your crash report and you will find exactly where it's called.
并不,代码在启用mmkv后立刻调用了enableAutoKeyExpire(),如果是你说的这种情况的话,不能解释为什么崩溃只崩在后台。
I believe the exception is crystal clear. You somehow call MMKV.default().setXXX() without enableAutoKeyExpire() first. Check the call stacks of your crash report and you will find exactly where it's called.
If enableAutoKeyExpire() fails you should NOT set key-value with expiration.
I don't know why it fails on prewarm for you provide no logs about it.
Anyway if it fails on prewarm, you might consider
prevent your app from continue running in prewarm
or somehow retry enableAutoKeyExpire() after it pass the prewam state.
If enableAutoKeyExpire() fails you should NOT set key-value with expiration.如果 enableAutoKeyExpire() 失败,则不应设置带过期时间的键值对。 I don't know why it fails on prewarm for you provide no logs about it.我不知道为什么预热会失败,你也没有提供相关日志。 Anyway if it fails on prewarm, you might consider总之,** 如果**预热失败,您可以考虑
prevent your app from continue running in prewarm防止您的应用程序在预热阶段继续运行
or somehow retry enableAutoKeyExpire() after it pass the prewam state.或者在通过 prewam 状态后以某种方式重试 enableAutoKeyExpire() 。
Activity
github-actions commentedon Sep 23, 2026
👋 Hello! Thanks for opening an issue.
Note
New features, bugfixes, updates and other improvements are all handled mostly by @lingol in his free time.
To support
@lingol, please consider 💖 sponsoring him on GitHub 💖.Sponsored issues will be prioritized.
(If you are already a sponsor, thank you! We will get to this shortly.)
lingol commentedon Sep 23, 2026
I believe the exception is crystal clear. You somehow call
MMKV.default().setXXX()withoutenableAutoKeyExpire()first. Check the call stacks of your crash report and you will find exactly where it's called.baobaomaomeng commentedon Sep 23, 2026
baobaomaomeng commentedon Sep 23, 2026
补充下,我查下了这些用户的日志,发现在崩溃的前几分钟都发生过版本更新的情况,在旧版本,后台会执行的set也是走double类型的,新版本我们修改了这个。我不清楚这是不是误报,理论上这个bug应该只发生在旧版本。
但是旧版本的这个崩溃也很令人摸不着头脑,我只找到了一种情况可以稳定复现这个,在有实况通知的情况下重启手机。在iOS的预热机制下app会在第一次解锁屏幕之前运行,从而enableAutoKeyExpire失败,导致崩溃。线上的情况是该bug崩溃率高达千分之一,我不清楚是否还有其他场景能触发这种预热导致的崩溃。
baobaomaomeng commentedon Sep 23, 2026
以及,为什么崩溃百分百集中在iOS26 及以上,预热机制明明是iOS 15引入的
lingol commentedon Sep 23, 2026
If
enableAutoKeyExpire()fails you should NOT set key-value with expiration.I don't know why it fails on prewarm for you provide no logs about it.
Anyway if it fails on prewarm, you might consider
enableAutoKeyExpire()after it pass the prewam state.baobaomaomeng commentedon Sep 23, 2026
我觉得你说的很对,我会先把设置过期时间这个修复。关于预热我目前没有办法判断app的启动是否是 prewarm,我网上找了点资料,试着用[ActivePrewarm]这个环境变量去检测,发现根本没有效果,你有什么好办法吗