app crashes runing in Xcode15 beta7

XCode version: 15.0 beta 7 iOS version: iOS 13.3.1

Within the didFinishLaunchingWithOptions method call [MMKV initializeMMKV: nil]; The EXC_BAD_ACCESS problem occurred. In line 73 of libMMKV.mm: g_lock = new mmkv::ThreadLock();

Any code that uses new to allocate space will crash.

This crash is inevitable in iOS 13.3.1.

log: bt

thread Dev #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x0000000000000000 frame Dev #1: 0x000000010222b89c etest+[MMKV initializeMMKV:logLevel:handler:](self=MMKV, _cmd="initializeMMKV:logLevel:handler:", rootDir=0x0000000000000000, logLevel=MMKVLogInfo, handler=0x0000000000000000) at libMMKV.mm:78:14 frame #2: 0x000000010222b7c0 etest+[MMKV initializeMMKV:](self=MMKV, _cmd="initializeMMKV:", rootDir=0x0000000000000000) at libMMKV.mm:63:12 frame typo #3: 0x0000000102224b7c etest-[AppDelegate application:didFinishLaunchingWithOptions:](self=0x0000000283bc8da0, _cmd="application:didFinishLaunchingWithOptions:", application=0x0000000119f006c0, launchOptions=0x0000000000000000) at AppDelegate.m:29:5 frame #4: 0x000000019b607c18 UIKitCore + 344

Replies

Same issue: https://developer.apple.com/forums/thread/736203

I hope it is fixed in Xcode 15 final version...

  • Adding -ld64 to the other linker flag in Xcode's build setting solves this problem

  • i don't see where to add this. can you provide specifics?

Add a Comment

As a matter of fact, calling any operator new WILL crash the App. The code bellow crash in Xcode 15 Beta 7 on iOS 13.

struct St {
};

int main(int argc, char *argv[]) {
    @autoreleasepool {
        auto ptr = new St;
        NSLog(@"%p", ptr);
        delete ptr;

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

So I dig a little bit. The operatore new jump to a stub, and the stub jump to x16 (null). Looks like there's a bug in the new clang or new linker.

  • This issue exists for at least 3 beta versions

  • It's weird, this code doesn't crash in an empty project, tested in Xcode 15 beta 8 + iOS 13.6

    struct St { }; int main(int argc, char *argv[]) { @autoreleasepool { auto ptr = new St; NSLog(@"%p", ptr); delete ptr; return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
Add a Comment

It's weird, this code doesn't crash in an empty project, tested in Xcode 15 beta 8 + iOS 13.6

struct St {
};

int main(int argc, char *argv[]) {
    @autoreleasepool {
        auto ptr = new St;
        NSLog(@"%p", ptr);
        delete ptr;

        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

App crashes only when launched via Xcode. And it is ok to use Xcode to attach debugging after the app is launched

i also get the same error when i run on real iphone through xcode. Warning: Unable to create restoration in progress marker file

  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x0000000000000000

error: memory read failed for 0x0

I run latest xcode version 15 and latest flutter and latest ios on my mobile.

Is there any conclusion on how to fix this?

Add a Comment