We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
My code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { dispatch_async(dispatch_get_global_queue(0, 0), ^{ [self configCrashLogManager]; }); return YES; } - (NSString *)crashLogsDirPath { NSString *cachePath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject; NSString *dirPath = [cachePath stringByAppendingPathComponent:@"KSCrashLog"]; return dirPath; } - (void)configCrashLogManager { NSString *dirPath = [self crashLogsDirPath]; BOOL isDir = NO; BOOL isDirExist = [[NSFileManager defaultManager] fileExistsAtPath:dirPath isDirectory:&isDir]; if (isDirExist == NO) { NSError *err = nil; isDirExist = [[NSFileManager defaultManager] createDirectoryAtPath:dirPath withIntermediateDirectories:YES attributes:nil error:&err]; if (isDirExist == YES) { NSLog(@"Create dir success"); } else { NSLog(@"Create dir failure %@", err); } } else { NSLog(@"Log dir exist"); } isDirExist = [[NSFileManager defaultManager] fileExistsAtPath:dirPath isDirectory:&isDir]; if (isDirExist == YES && isDir == YES) { KSCrash *ksCrash = [[KSCrash alloc] initWithBasePath:dirPath]; if ([ksCrash install]) { self.myCrashLogger = ksCrash; NSLog(@"KSCrash init success"); } else { NSLog(@"KSCrash init failure"); } } else { if (isDirExist && isDir == NO) { NSLog(@"The log path file with the same name exists but is not a folder"); } else { NSLog(@"The log folder does not exist, and may fail to be created"); } } }
The crash log:
Incident Identifier: 8F0F78C6-9E1B-462E-8F93-567270EFBFB6 CrashReporter Key: 7b1bbde74893b92e958938439a623919a12a8de9 Hardware Model: iPhone10,3 Process: TestKSCrash [1656] Path: /private/var/containers/Bundle/Application/2DF86E55-F808-415F-B776-2047C90387F5/TestKSCrash.app/TestKSCrash Identifier: Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd [1] Coalition: Date/Time: 2023-06-19 18:10:01.9071 +0800 Launch Time: 2023-06-19 18:06:35.4987 +0800 OS Version: iPhone OS 16.0 (20A362) Release Type: User Baseband Version: 8.04.01 Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001db9d2a1c Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [1656] Triggered by Thread: 4 Application Specific Information: BUG IN CLIENT OF LIBDISPATCH: trying to lock recursively Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0: 0 libsystem_kernel.dylib 0x20d31e194 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x20d32fa08 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x20d32fc44 mach_msg_overwrite + 384 3 libsystem_kernel.dylib 0x20d31e688 mach_msg + 20 4 CoreFoundation 0x1cfe9f244 __CFRunLoopServiceMachPort + 156 5 CoreFoundation 0x1cfea03f4 __CFRunLoopRun + 1232 6 CoreFoundation 0x1cfea4dfc CFRunLoopRunSpecific + 584 7 GraphicsServices 0x209d5a984 GSEventRunModal + 160 8 UIKitCore 0x1d7087e7c -[UIApplication _run] + 868 9 UIKitCore 0x1d7087af4 UIApplicationMain + 312 10 TestKSCrash 0x10283bd20 main + 124 11 dyld 0x1f1562de0 start + 2080 Thread 1: 0 libsystem_pthread.dylib 0x21bee0674 start_wqthread + 0 Thread 2: 0 libsystem_pthread.dylib 0x21bee0674 start_wqthread + 0 Thread 3: 0 libsystem_pthread.dylib 0x21bee0674 start_wqthread + 0 Thread 4 name: Dispatch queue: com.apple.root.default-qos Thread 4 Crashed: 0 libdispatch.dylib 0x1db9d2a1c _dispatch_once_wait$VARIANT$armv81.cold.1 + 28 1 libdispatch.dylib 0x1db99a21c _dispatch_once_wait$VARIANT$armv81 + 180 2 TestKSCrash 0x1028a4f64 +[KSCrash sharedInstance] + 84 3 TestKSCrash 0x102883ef8 setEnabled + 136 4 TestKSCrash 0x102876848 setMonitorEnabled + 84 5 TestKSCrash 0x102876788 kscm_setActiveMonitors + 244 6 TestKSCrash 0x1028917c8 kscrash_setMonitoring + 52 7 TestKSCrash 0x1028a545c -[KSCrash setMonitoring:] + 32 8 TestKSCrash 0x1028a51e0 -[KSCrash initWithBasePath:] + 384 9 TestKSCrash 0x1028a5028 -[KSCrash init] + 80 10 TestKSCrash 0x1028a4fb8 __25+[KSCrash sharedInstance]_block_invoke + 44 11 libdispatch.dylib 0x1db9ca7c8 _dispatch_client_callout + 16 12 libdispatch.dylib 0x1db99af40 _dispatch_once_callout + 28 13 TestKSCrash 0x1028a4f64 +[KSCrash sharedInstance] + 84 14 TestKSCrash 0x102883ef8 setEnabled + 136 15 TestKSCrash 0x102876848 setMonitorEnabled + 84 16 TestKSCrash 0x102876788 kscm_setActiveMonitors + 244 17 TestKSCrash 0x1028917c8 kscrash_setMonitoring + 52 18 TestKSCrash 0x1028915b0 kscrash_install + 380 19 TestKSCrash 0x1028a61b8 -[KSCrash install] + 108 20 TestKSCrash 0x10283b7b8 -[AppDelegate configCrashLogManager] + 532 21 TestKSCrash 0x10283b4d8 __57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke + 36 22 libdispatch.dylib 0x1db9c9850 _dispatch_call_block_and_release + 24 23 libdispatch.dylib 0x1db9ca7c8 _dispatch_client_callout + 16 24 libdispatch.dylib 0x1db9a1b2c _dispatch_queue_override_invoke + 708 25 libdispatch.dylib 0x1db9aed48 _dispatch_root_queue_drain + 328 26 libdispatch.dylib 0x1db9af514 _dispatch_worker_thread2 + 160 27 libsystem_pthread.dylib 0x21bee0b14 _pthread_wqthread + 224 28 libsystem_pthread.dylib 0x21bee067c start_wqthread + 8 Thread 5: 0 libsystem_pthread.dylib 0x21bee0674 start_wqthread + 0 Thread 6 name: com.apple.uikit.eventfetch-thread Thread 6: 0 libsystem_kernel.dylib 0x20d31e194 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x20d32fa08 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x20d32fc44 mach_msg_overwrite + 384 3 libsystem_kernel.dylib 0x20d31e688 mach_msg + 20 4 CoreFoundation 0x1cfe9f244 __CFRunLoopServiceMachPort + 156 5 CoreFoundation 0x1cfea03f4 __CFRunLoopRun + 1232 6 CoreFoundation 0x1cfea4dfc CFRunLoopRunSpecific + 584 7 Foundation 0x1cf2073fc -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 8 Foundation 0x1cf2072f8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 9 UIKitCore 0x1d71ac6d0 -[UIEventFetcher threadMain] + 424 10 Foundation 0x1cf21ef44 __NSThread__start__ + 704 11 libsystem_pthread.dylib 0x21bee2060 _pthread_start + 116 12 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 7: 0 libsystem_kernel.dylib 0x20d31e610 __semwait_signal + 8 1 libsystem_c.dylib 0x1db9ef330 nanosleep + 216 2 libsystem_c.dylib 0x1dba02f18 sleep + 48 3 TestKSCrash 0x102895eec monitorCachedData + 128 4 libsystem_pthread.dylib 0x21bee2060 _pthread_start + 116 5 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 8 name: KSCrash Exception Handler (Secondary) Thread 8: 0 libsystem_kernel.dylib 0x20d31e194 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x20d32fa08 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x20d32a054 thread_suspend + 108 3 TestKSCrash 0x1028793e4 handleExceptions + 128 4 libsystem_pthread.dylib 0x21bee2060 _pthread_start + 116 5 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 9 name: KSCrash Exception Handler (Primary) Thread 9: 0 libsystem_kernel.dylib 0x20d31e194 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x20d32faa0 mach_msg2_internal + 228 2 libsystem_kernel.dylib 0x20d32fc44 mach_msg_overwrite + 384 3 libsystem_kernel.dylib 0x20d31e688 mach_msg + 20 4 TestKSCrash 0x10287941c handleExceptions + 184 5 libsystem_pthread.dylib 0x21bee2060 _pthread_start + 116 6 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 10 name: KSCrash Exception Handler (Secondary) Thread 10: 0 libsystem_kernel.dylib 0x20d31e194 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x20d32fa08 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x20d32fc44 mach_msg_overwrite + 384 3 libsystem_kernel.dylib 0x20d31e688 mach_msg + 20 4 TestKSCrash 0x10287941c handleExceptions + 184 5 libsystem_pthread.dylib 0x21bee2060 _pthread_start + 116 6 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 11 name: KSCrash Exception Handler (Primary) Thread 11: 0 libsystem_pthread.dylib 0x21bee4600 _pthread_setcancelstate_exit$VARIANT$armv81 + 0 1 libsystem_pthread.dylib 0x21bee59a4 _pthread_exit + 44 2 libsystem_pthread.dylib 0x21bee206c _pthread_start + 128 3 libsystem_pthread.dylib 0x21bee0688 thread_start + 8 Thread 4 crashed with ARM Thread State (64-bit): x0: 0x00000001028dc2f8 x1: 0x0000000000002401 x2: 0x00000001028a4f8c x3: 0x000000016d7f6660 x4: 0x0000000003000001 x5: 0x0000000000000003 x6: 0x0000000000000000 x7: 0x0000000000000000 x8: 0x0000000000000003 x9: 0x0000000000002400 x10: 0x0000000281be5100 x11: 0x0003000281be5100 x12: 0x0000000000000001 x13: 0x0000000281be5100 x14: 0x00000002302fa428 x15: 0x00000002302fa428 x16: 0x00000001db99aeb0 x17: 0x000000021bedc314 x18: 0x0000000000000000 x19: 0x00000001028dc2f8 x20: 0x0000000000002403 x21: 0x0000000000000000 x22: 0x0000000000000000 x23: 0x0000000000000114 x24: 0x000000016d7f70e0 x25: 0x00000002302f7c80 x26: 0x00000000000005ff x27: 0x000000022bae7204 x28: 0x0000000000000000 fp: 0x000000016d7f67a0 lr: 0x00000001db99a21c sp: 0x000000016d7f6790 pc: 0x00000001db9d2a1c cpsr: 0x60000000 far: 0x000000016dbcb000 esr: 0xf2000001 (Breakpoint) brk 1 Binary Images: 0x20d31d000 - 0x20d352fff libsystem_kernel.dylib arm64 <f984bd5d5eb83894b57d307eab4e7b07> /usr/lib/system/libsystem_kernel.dylib 0x1cfe29000 - 0x1d01f4fff CoreFoundation arm64 <5f4831c9494934eab3733f45c312b753> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x209d59000 - 0x209d61fff GraphicsServices arm64 <df370b2c9baa33c8ba00b54d2f4538dc> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 0x1d6d11000 - 0x1d83cbfff UIKitCore arm64 <0a5f2ff1a67f3263bafc1224b1501a17> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore 0x102834000 - 0x1028c3fff TestKSCrash arm64 <4b2dcbc67edd30908eae3855f67e8baa> /private/var/containers/Bundle/Application/2DF86E55-F808-415F-B776-2047C90387F5/TestKSCrash.app/TestKSCrash 0x1f154f000 - 0x1f15c8dcb dyld arm64 <39fb7cd57af23e3c9cefb214ddbc3353> /usr/lib/dyld 0x21bedf000 - 0x21beeffff libsystem_pthread.dylib arm64 <c505adfd68fb3e92aaa8af0ed030c66b> /usr/lib/system/libsystem_pthread.dylib 0x1db966000 - 0x1db9e9fff libdispatch.dylib arm64 <abe14ca70020314dbba65f92f0bbb1c4> /usr/lib/system/libdispatch.dylib 0x1cf1c9000 - 0x1cfa75fff Foundation arm64 <0b0d93617efa31da95246f4a7412b618> /System/Library/Frameworks/Foundation.framework/Foundation 0x1db9ea000 - 0x1dba65fff libsystem_c.dylib arm64 <637814c516103a04b2544eb2b26b750b> /usr/lib/system/libsystem_c.dylib EOF
The text was updated successfully, but these errors were encountered:
No branches or pull requests
My code:
The crash log:
The text was updated successfully, but these errors were encountered: