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

鸿蒙Next纯血版本如何接入mmkv? #1261

Closed
ChawLoo opened this issue Mar 28, 2024 · 19 comments
Closed

鸿蒙Next纯血版本如何接入mmkv? #1261

ChawLoo opened this issue Mar 28, 2024 · 19 comments

Comments

@ChawLoo
Copy link

ChawLoo commented Mar 28, 2024

原先想通过编译成CPP引入,但是那一块不太熟悉,原先打算用CMake编译后去接入,但是搞不明白

@lingol
Copy link
Collaborator

lingol commented Mar 28, 2024

The official support of MMKV for OpenHarmonyOS is under construction. You can wait for it.

@ChawLoo
Copy link
Author

ChawLoo commented Mar 28, 2024

预估多久面市?

@lingol
Copy link
Collaborator

lingol commented Mar 28, 2024

I can't say for sure. Eventually, it should be released before the next big event of the OHOS Next.

@alhah
Copy link

alhah commented Mar 28, 2024

Does the big event mean WeChat porting to OHOS?

@lingol
Copy link
Collaborator

lingol commented Apr 2, 2024

The undergoing work can be found in the branch dev_openharmony. It's still in an early stage.

@wangyatong
Copy link

24年年底之前绝对上线🤪

@lingol
Copy link
Collaborator

lingol commented Apr 18, 2024

For those who would try, it's live on OHPM. https://ohpm.openharmony.cn/#/cn/detail/@tencent%2Fmmkv
wiki https://github.com/Tencent/MMKV/wiki/ohos_setup

@ChawLoo
Copy link
Author

ChawLoo commented Apr 18, 2024

牛啊牛啊

@ChawLoo
Copy link
Author

ChawLoo commented Apr 18, 2024

我mini m2芯片,跑的模拟器、真机跑了也有问题
image

@ChawLoo
Copy link
Author

ChawLoo commented Apr 18, 2024

最新测试结果,真机一样有问题

@pioneerz
Copy link

最新测试结果,真机一样有问题

我mini m2芯片,跑的模拟器 image

image
这个限制还挺多的

@ChawLoo
Copy link
Author

ChawLoo commented Apr 18, 2024

最新测试结果,真机一样有问题

我mini m2芯片,跑的模拟器 image

image 这个限制还挺多的

但是我满足呀,手机目前Mate 60 Pro Preview 2版本 ,模拟器也是Beta1版本
image

@lingol
Copy link
Collaborator

lingol commented Apr 18, 2024

What's the log from hilog?

@ChawLoo
Copy link
Author

ChawLoo commented Apr 19, 2024

What's the log from hilog?

04-19 09:06:29.479 43415-43415 A03D00/JSAPP pid-43415 I Callee constructor is OK string
04-19 09:06:29.479 43415-43415 A03D00/JSAPP pid-43415 I Ability::constructor callee is object [object Object]
04-19 09:06:29.487 43415-43415 A00000/MMKV pid-43415 I <native_bridge.cpp:337::initialize> NAPI Error: code 6, msg Need number
04-19 09:06:29.499 43415-43415 A00000/testTag pid-43415 I Ability onWindowStageCreate
04-19 09:06:29.499 43415-43415 A03D00/JSAPP pid-43415 I 初始化配置缓存框架
04-19 09:06:29.501 43415-43415 A00000/testTag pid-43415 I Ability onForeground

image

@lingol
Copy link
Collaborator

lingol commented Apr 19, 2024

I see. There's a bug in MMKV.initialize() on handling optional parameters. Will fix in the next version.
For the time being, you can bypass this by passing the logLevel param:

import { MMKV, MMKVLogLevel } from '@tencent/mmkv';

let appCtx = this.context.getApplicationContext();
MMKV.initialize(appCtx, MMKVLogLevel.LevelInfo);

lingol added a commit that referenced this issue Apr 19, 2024
@lingol
Copy link
Collaborator

lingol commented Apr 19, 2024

It's fixed in "@tencent/mmkv": "1.3.5-alpha".

@lebusishu
Copy link

我mini m2芯片,跑的模拟器、真机跑了也有问题 image

也遇到了,需要指定MMKVLogLevel才可以,我这样就可以了:MMKV.initializeWithPath(filePath, context.cacheDir, MMKVLogLevel.LevelInfo)

@lingol
Copy link
Collaborator

lingol commented Apr 22, 2024

我mini m2芯片,跑的模拟器、真机跑了也有问题 image

也遇到了,需要指定MMKVLogLevel才可以,我这样就可以了:MMKV.initializeWithPath(filePath, context.cacheDir, MMKVLogLevel.LevelInfo)

Try it.
It's fixed in "@tencent/mmkv": "1.3.5-alpha".

@lingol
Copy link
Collaborator

lingol commented Apr 24, 2024

It's released in v1.3.5.

@lingol lingol closed this as completed Apr 24, 2024
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

6 participants