Tencent / MMKV

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

鸿蒙初始化异常 #1376

Closed zangxuyfd closed 2 months ago

zangxuyfd commented 2 months ago

Note:

An crash issue will be ignored & closed in a week without logs.

The language of MMKV

e.g. Objective-C, Swift, Java, or Kotlin

The version of MMKV

e.g. v1.2.2
Note: For versions older than the latest version, please upgrade before posting any issue.
We don't have much time for old version tech support.

The platform of MMKV

e.g. iOS or Android

The installation of MMKV

e.g. Cocoapods, Maven, or Git clone

What's the issue?

Post the outputs or screenshots for errors.

Explain what you want by example or code in English. If you have a crash/OOM/ANR on Android, please provide symbolize stack traces. https://developer.android.com/ndk/guides/ndk-stack.html

What's the log of MMKV when that happened?

Your detail logs. As much as possible. For how to forward MMKV's log, you can checkout the wiki on each platform. An crash issue will be ignored & closed in a week without logs.

The platform of MMKV

鸿蒙

"dependencies": { "@tencent/mmkv": "1.3.9", }

The version of MMKV

"1.3.9"

code: try { const rootDir = context.filesDir + '/ZebraMMKV'; MMKV.initializeWithPath(rootDir, context.cacheDir); } catch (e) {

}

打印出的error信息是 error: TypeError: is not callable

文档中: Customize location By default, MMKV stores file inside $(FilesDir)/mmkv/. You can customize MMKV's root directory on App startup:

let appCtx = this.context.getApplicationContext(); let rootDir = appCtx.filesDir + '/mmkv_2'; let cacheDir = appCtx.cacheDir; MMKV.initialize(rootDir, cacheDir);

MMKV.initialize(rootDir, cacheDir); 这方法在1.3.9 貌似已经没有了

zangxuyfd commented 2 months ago

initializeWithPath is not callable 但是 确实是public 方法啊

lingol commented 2 months ago

1381