Tencent / MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.
Other
17.26k stars 1.89k forks source link

iOS mmkv 沙盒目录下 权限问题 #1246

Closed xiaoyeying closed 4 months ago

xiaoyeying commented 6 months ago

iOS Objective-C编码下

通过Cocoapods管理 MMKV_VERSION = "v1.3.2"

记录到如下日志

fail to open:/var/mobile/Containers/Data/Application/4E2F1FAB-F402-4BFE-9035-87BD355F6A72/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault, Operation not permitted InvalidProtocolBuffer truncatedMessage check crc [UserDefault] fail, crc32:1965248185, m_crcDigest:2381180596 file [/var/mobile/Containers/Data/Application/C931BEA1-C36B-4BFB-A247-86A18126580F/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault] not valid
lingol commented 6 months ago

Why did your location change? At one time it's

/var/mobile/Containers/Data/Application/4E2F1FAB-F402-4BFE-9035-87BD355F6A72/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault

Later it becomes:

/var/mobile/Containers/Data/Application/C931BEA1-C36B-4BFB-A247-86A18126580F/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault

lingol commented 6 months ago

I don't think you have provided logs in the order as it happens. Please provide logs with timestamps. And don't mix logs from different devices/users.

xiaoyeying commented 6 months ago

抱歉,谢谢解答

这个是相同设备的日志信息,几乎是同一时间点记录到的日志 时间点 2024-0310-1824 日志信息 fail to open [/var/mobile/Containers/Data/Application/4E2F1FAB-F402-4BFE-9035-87BD355F6A72/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault.crc], 1(Operation not permitted) 时间点2024-0310-1824 日志信息 fail to open [/var/mobile/Containers/Data/Application/4E2F1FAB-F402-4BFE-9035-87BD355F6A72/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault], 1(Operation not permitted)

问题: 我们这边记录到用户读写均失效的情况,未知原因,日志较多,这个是截取一部分比较典型的日志

疑问点: 我这边的疑问点是正常状态下读取均是正常的,为何会存在沙盒文件的权限错误日志,这种是否会导致无法正常读写数据

lingol commented 6 months ago

On that device, does things work normally before? Or does it never work? You should provide as many logs of MMKV as possible. With just these two single logs it's impossible to do any diagnosis.

lingol commented 6 months ago

Last time I checked, on iOS an App is always sanboxed. So I don't quite understand why you said "正常状态下读取均是正常的". What do you mean by saying "正常状态"?

xiaoyeying commented 6 months ago

应用程序线上环境处于沙盒状态下,有记录到的绝大部分是以上相似的日志,除此之外还有类似日子

check crc [UserDefault] fail, crc32:2447369466, m_crcDigest:2915453613
xiaoyeying commented 6 months ago

应用程序线上环境处于沙盒状态下,有记录到的绝大部分是以上相似的日志,除此之外还有类似日子

check crc [UserDefault] fail, crc32:2447369466, m_crcDigest:2915453613 请问有没有什么可能的原因导致此问题
lingol commented 6 months ago

Last time I checked, on iOS an App is always sanboxed. So I don't quite understand why you said "正常状态下读取均是正常的". What do you mean by saying "正常状态"?

lingol commented 6 months ago

On that device, does things work normally before? Or does it never work? You should provide as many logs of MMKV as possible. With just these two single logs it's impossible to do any diagnosis.

xiaoyeying commented 6 months ago
  1. 记录到的日志基本是重复的,主要是以下内容为主,麻烦请教下这个有可能是某种场景导致的呢?或者请教下发生此场景的时候,读和写是不是意味着完全失效了

[/var/mobile/Containers/Data/Application/4E2F1FAB-F402-4BFE-9035-87BD355F6A72/Library/com.zhibo8.client81136870/UserDefault/mmkv/UserDefault]

MMKV.cpp:417::checkFileCRCValid check crc [UserDefault] failed, crc32:2447369466 , m_crcDigest:2915453613

lingol commented 6 months ago

On that device, does things work normally before? Or does it never work? You should provide as many logs of MMKV as possible. With just these two single logs it's impossible to do any diagnosis.

lingol commented 6 months ago

One more useless response and this issue will be locked down. Please provide info as required.

lingol commented 4 months ago

Closed due to inactive.