Crashed: com.apple.root.background-qos SIGABRT ABORT 0x000000018373d2ec

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (322)

应用程序在启动时崩溃。它不会每次都崩溃。下面的代码执行初始化NSCalendar对象并用于日期和时间计算。

static NSCalendar *calendar;
+(NSCalendar*)getCalendar {
    if (calendar == nil) {
        calendar = [NSCalendar currentCalendar];
        [calendar setFirstWeekday:1];
        [calendar setMinimumDaysInFirstWeek:1];
    }
    return calendar;
}

有时会在[calendar setFirstWeekday:1]或[calendar setMinimumDaysInFirstWeek:1]行观察到崩溃;

Crashed: com.apple.root.background-qos
0  libsystem_kernel.dylib         0x18373d2ec __pthread_kill + 8
1  libsystem_pthread.dylib        0x1838de288 pthread_kill$VARIANT$mp + 376
2  libsystem_c.dylib              0x1836abd0c abort + 140
3  libc++abi.dylib                0x182e472c8 __cxa_bad_cast + 130
4  libc++abi.dylib                0x182e47470 default_unexpected_handler() + 302
5  libobjc.A.dylib                0x182e708d4 _objc_terminate() + 124
6  libc++abi.dylib                0x182e6137c std::__terminate(void (*)()) + 16
7  libc++abi.dylib                0x182e60f78 __cxa_rethrow + 144
8  libobjc.A.dylib                0x182e707ac objc_exception_rethrow + 44
9  CoreFoundation                 0x183cceb44 -[_NSCopyOnWriteCalendarWrapper setMinimumDaysInFirstWeek:] + 152
10 myapp                          0x104fc81e4 +[Utils getCalendar] (Utils.m:405)
11 myapp                          0x104fc8504 +[Utils dateByAddingUnit:value:toDate:] (Utils.m:474)
12 myapp                          0x104f1218c +[LocalNotificaitonUtils cancelAndScheduleNotificationWithType:message:delta:category:] (LocalNotificaitonUtils.m:355)
13 libdispatch.dylib              0x1835a8b24 _dispatch_call_block_and_release + 24
14 libdispatch.dylib              0x1835a8ae4 _dispatch_client_callout + 16
15 libdispatch.dylib              0x1835b5e80 _dispatch_root_queue_drain + 924
16 libdispatch.dylib              0x1835b5a80 _dispatch_worker_thread3 + 120
17 libsystem_pthread.dylib        0x1838dbfac _pthread_wqthread + 1176
18 libsystem_pthread.dylib        0x1838dbb08 start_wqthread + 4
提问于
用户回答回答于
+(NSCalendar*)getCalendar {
 NSCalendar *calendar = [NSCalendar currentCalendar];
 [calendar setFirstWeekday:1];
 [calendar setMinimumDaysInFirstWeek:1];
 return calendar;
}

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励