Skip to content

升级 Xcode 16 之后 g_rootDir 丢失 #1485

Closed Answered by lingol
zrqSimon asked this question in Q&A
Discussion options

You must be logged in to vote

Oh, I just noticed that you init mmkv by some +load method. Looks like it's invoked before the g_rootDir's own initialization function __cxx_global_var_init.
Never do that.
Move to the didFinishLuanching as we suggested in the doc/wiki.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // init MMKV in the main thread
    [MMKV initializeMMKV:nil];

    //...
    return YES;
}

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
10 replies
@lingol
Comment options

@lingol
Comment options

@zrqSimon
Comment options

@zrqSimon
Comment options

@lingol
Comment options

Comment options

You must be logged in to vote
2 replies
@zrqSimon
Comment options

@lingol
Comment options

Answer selected by lingol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants