从Xcode 10和iOS 12开始,我们的CI服务器会随机失败,因为一个或多个测试在模拟器上崩溃了。
日志文件中的内容类似
Test Case '-[SJDNotificationToObjectIDMarshallerTest testItMarshalsAnObjectID]' started.
Test Case '-[SJDNotificationToObjectIDMarshallerTest testItMarshalsAnObjectID]' passed (0.003 seconds).
objc[43030]: Attempt to use unknown class 0x7fe4a241cfa0.
Restarting after unexpected exit or crash in SJDNotificationToObjectIDMarshallerTest/testItMarshalsAnObjectID; summary will include totals from previous launches.
测试用例在不同的运行中有所不同。错误Attempt to use unknown class
始终相同。
很难重现,因为它仅在CI服务器(Mac Mini)上每隔一秒钟进行一次测试。在速度更快的MacBook Pro上,这种情况很少发生。但是我确实在我的机器上复制了几次。在运行测试时,Xcode将暂停并显示崩溃的线程。回溯显示:
* thread #2, queue = 'DTXChannel serializer queue [x1.c1]', stop reason = signal SIGABRT
* frame #0: 0x000000010ba5801e libsystem_kernel.dylib`__abort_with_payload + 10
frame #1: 0x000000010ba53561 libsystem_kernel.dylib`abort_with_payload_wrapper_internal + 82
frame #2: 0x000000010ba5350f libsystem_kernel.dylib`abort_with_reason + 22
frame #3: 0x0000000108ae91f5 libobjc.A.dylib`_objc_fatalv(unsigned long long, unsigned long long, char const*, __va_list_tag*) + 108
frame #4: 0x0000000108ae911e libobjc.A.dylib`_objc_fatal(char const*, ...) + 127
frame #5: 0x0000000108af1409 libobjc.A.dylib`lookUpImpOrForward + 645
frame #6: 0x0000000108afe814 libobjc.A.dylib`_objc_msgSend_uncached + 68
frame #7: 0x000000010951ac23 CoreFoundation`__21+[__NSSetI __new::::]_block_invoke + 51
frame #8: 0x000000010951ab1a CoreFoundation`+[__NSSetI __new::::] + 474
frame #9: 0x0000000109570ed4 CoreFoundation`+[NSSet setWithObjects:count:] + 52
frame #10: 0x0000000109571eab CoreFoundation`-[NSSet setByAddingObjectsFromSet:] + 763
frame #11: 0x000000011c015f44 DTXConnectionServices`-[DTXProxyChannel _allowedClassesForReturnValues] + 109
frame #12: 0x000000011c016722 DTXConnectionServices`__42-[DTXProxyChannel _sendInvocationMessage:]_block_invoke + 260
frame #13: 0x000000011c024e76 DTXConnectionServices`__51-[DTXChannel _scheduleMessage:tracker:withHandler:]_block_invoke.751 + 101
frame #14: 0x000000010b6a651d libdispatch.dylib`_dispatch_call_block_and_release + 12
frame #15: 0x000000010b6a7587 libdispatch.dylib`_dispatch_client_callout + 8
frame #16: 0x000000010b6ae058 libdispatch.dylib`_dispatch_lane_serial_drain + 720
frame #17: 0x000000010b6aeb9b libdispatch.dylib`_dispatch_lane_invoke + 401
frame #18: 0x000000010b6b79c6 libdispatch.dylib`_dispatch_workloop_worker_thread + 645
frame #19: 0x000000010ba9061c libsystem_pthread.dylib`_pthread_wqthread + 409
frame #20: 0x000000010ba90415 libsystem_pthread.dylib`start_wqthread + 13
有人知道发生了什么吗?
在每个运行iOS 12或12.1 Beta的模拟器中,它都可以在Xcode 10 GM和当前的Beta 10.1 10O35n中复制。 在iOS 11 Simulator上无法复制。
答案 0 :(得分:1)
我花了很多时间试图解决同样的问题。
为我解决此问题的最佳方法是删除OCMocks
中的NS-classes
:NSString
,NSArray
等。
我对此没有任何信息,但是这种解决方案对我有用。