facebookarchive / xctool

An extension for Apple's xcodebuild that makes it easier to test iOS and macOS apps.
Apache License 2.0
6.91k stars 738 forks source link

Crash on '+[SimDeviceType supportedDevices]: unrecognized selector in Xcode 8.3 #730

Closed vmaraccini closed 7 years ago

vmaraccini commented 7 years ago

It would seem that this method has been removed in Xcode 8.3 (after it was deprecated in 8.1): [SimDeviceType supportedDevices]

This causes a weird crash while trying to run the tool because of this assertion:

NSAssert([supportedDeviceTypes count] > 0, @"There are no available devices that support provided sdk: %@. Supported devices: %@", [runtime name], [[SimDeviceType supportedDevices] valueForKeyPath:@"name"]);

Here's the full stacktrace for completeness:

2017-04-28 17:41:52.492 xctool[25478:5004806] +[SimDeviceType supportedDevices]: unrecognized selector sent to class 0x105109140
2017-04-28 17:41:52.493 xctool[25478:5004806] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SimDeviceType supportedDevices]: unrecognized selector sent to class 0x105109140'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8819137b __exceptionPreprocess + 171
    1   libobjc.A.dylib                     0x00007fff9cf8548d objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff88212e44 +[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00007fff88103805 ___forwarding___ + 1061
    4   CoreFoundation                      0x00007fff88103358 _CF_forwarding_prep_0 + 120
    5   xctool                              0x000000010477b7d8 -[SimulatorInfo simulatedDeviceInfoName] + 2264
    6   xctool                              0x000000010477bac4 -[SimulatorInfo maxSdkVersionForSimulatedDevice] + 68
    7   xctool                              0x000000010477bcd9 -[SimulatorInfo simulatedSdkVersion] + 137
    8   xctool                              0x000000010477c1f8 -[SimulatorInfo sdkInfoForSimulatedSdk] + 712
    9   xctool                              0x000000010477c468 -[SimulatorInfo simulatedRuntime] + 40
    10  xctool                              0x000000010477c549 -[SimulatorInfo simulatedDevice] + 89
    11  xctool                              0x0000000104744a78 CreateTaskForSimulatorExecutable + 424
    12  xctool                              0x00000001047d89c9 -[OCUnitIOSLogicTestQueryRunner createTaskForQuery] + 713
    13  xctool                              0x0000000104758ee5 -[OCUnitTestQueryRunner runQueryWithError:] + 805
    14  xctool                              0x00000001047d30bd +[TestableExecutionInfo queryTestCasesWithSimulatorInfo:error:] + 589
    15  xctool                              0x00000001047d1f41 +[TestableExecutionInfo infoForTestable:buildSettings:simulatorInfo:] + 369
    16  xctool                              0x0000000104763ea4 __56-[RunTestsAction runTestables:options:xcodeSubjectInfo:]_block_invoke + 1380
    17  libdispatch.dylib                   0x00007fff9d83d524 _dispatch_call_block_and_release + 12
    18  libdispatch.dylib                   0x00007fff9d8348fc _dispatch_client_callout + 8
    19  libdispatch.dylib                   0x00007fff9d84a6f1 _dispatch_queue_serial_drain + 209
    20  libdispatch.dylib                   0x00007fff9d83d306 _dispatch_queue_invoke + 1046
    21  libdispatch.dylib                   0x00007fff9d843020 _dispatch_queue_override_invoke + 369
    22  libdispatch.dylib                   0x00007fff9d8366b5 _dispatch_root_queue_drain + 476
    23  libdispatch.dylib                   0x00007fff9d83648c _dispatch_worker_thread3 + 99
    24  libsystem_pthread.dylib             0x00007fff9da83616 _pthread_wqthread + 1299
    25  libsystem_pthread.dylib             0x00007fff9da830f1 start_wqthread + 13
)
oxcug commented 7 years ago

I believe this might be related to an issue I submitted ( #729 ) as well.

ExtremeMan commented 7 years ago

I will take a look. Anyway xctool crashes after printing this error message. You've provided wrong simulator name.

ExtremeMan commented 7 years ago

Fixed in https://github.com/facebook/xctool/commit/03c1c022b1936f8afbae5a297b3a3e3fa551cad7.