Closed zlmac closed 8 months ago
By default, MMKV stores files inside $(Documents)/mmkv/. Suppose you have "abc" in the old default directory, here's how you can read from it:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
auto libraryPath = (NSString *) [paths firstObject];
auto oldRootDir = [libraryPath stringByAppendingPathComponent:@"mmkv"];
auto mmkv = [MMKV mmkvWithID:@"abc" relativePath:oldRootDir];
For more information, https://github.com/Tencent/MMKV/wiki/iOS_advance#customize-location
iOS 初始化,之前是默认根目录, [MMKV initializeMMKV: nil];
现在想改成自定义的根目录, [MMKV initializeMMKV: myRootDir];
改完后之前保存的数据怎么继续使用呢?