XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.59k stars 119 forks source link

Crashes when using iOS 13/14 runtimes #295

Open NachoSoto opened 1 year ago

NachoSoto commented 1 year ago

I've looked but haven't been able to find these issues referenced anywhere.

I'm migrating from xcversion to xcodes because of https://github.com/xcpretty/xcode-install/issues/466. Unfortunately I'm running into lots of issues with the iOS 13 and 14 runtimes. iOS 12 works properly.

I've seen 2 different issues in CI:

Library not loaded: @rpath/XCTest.framework/XCTest
  Referenced from: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.5.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/Frameworks/StoreKitTest.framework/StoreKitTest
  Reason: Incompatible library version: StoreKitTest requires version 1.0.0 or later, but XCTest provides version 0.0.0))
Process spawn via launchd failed.
xctest encountered an error (Failed to install or launch the test runner. If you believe this error represents a bug, please attach the result bundle at /Users/distiller/purchases-ios/fastlane/test_output/xctest/ios/RevenueCat.xcresult. (Underlying Error: Process spawn via launchd failed. Bad file descriptor. (Underlying Error: The operation couldn't be completed. (Mach error 9 - (os/kern) memory failure))))

And this when testing locally:

2023-06-02 13:59:04.682639-0700 UnitTestsHostApp[55076:18788661] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSXPCInterfaceProxy_ASDOctaneServiceProtocol setStringValue:forIdentifier:forBundleID:completion:]: unrecognized selector sent to instance 0x6000015ba120'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001803f61fc __exceptionPreprocess + 236
    1   libobjc.A.dylib                     0x000000018016a438 objc_exception_throw + 56
    2   CoreFoundation                      0x00000001804054c4 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x00000001803fa45c ___forwarding___ + 1408
    4   CoreFoundation                      0x00000001803fc42c _CF_forwarding_prep_0 + 92
    5   StoreKitTest                        0x0000000103769674 -[SKTestSession _setStringValue:forIdentifier:error:] + 252
    6   StoreKitTest                        0x0000000103767e58 -[SKTestSession setLocale:] + 72

All pointing to StoreKitTest somehow being corrupted.

Repro steps:

(You can use https://github.com/RevenueCat/purchases-ios but I'm sure this reproduces with any other project, probably using StoreKitTest)

I'm able to reproduce this in CI (CircleCI), locally on command line, but interestingly enough also when running tests with Xcode on a simulator created from that runtime.

Installing the runtime directly from Xcode does work properly, so I'm very puzzled as to what's wrong with these runtimes installed through xcodes.

NachoSoto commented 1 year ago

For the third issue, I managed to isolate it to using SKTestSession.locale under iOS 13 and 14. I filed a Radar for that: FB12223404.

For the other 2 I'm still running into them, but I think I have the same issue if I install the runtimes directly through Xcode, so I guess there's nothing wrong with xcodes.

The first one happens with iOS 14.x (only on CircleCI for some reason) and the second one with iOS 13.x on both CircleCI and locally. I'm still trying to dig through the reason.