be.with.veeresh
be.with.veeresh

Reputation: 587

Build creation issue for iOS10 by Xcode8 on Jenkins

** INTERNAL ERROR: Uncaught exception **

Uncaught Exception: The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations:

Stack: 0 0x00007fff95278aca __exceptionPreprocess (in CoreFoundation) 1 0x00007fff95c8273c objc_exception_throw (in libobjc.A.dylib) 2 0x00007fff952788ba +[NSException raise:format:arguments:] (in CoreFoundation) 3 0x00007fff924d288c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation)

Upvotes: 2

Views: 599

Answers (2)

Jeremy Huddleston Sequoia
Jeremy Huddleston Sequoia

Reputation: 23651

This issue indicates that the loaded CoreSimulatorService job doesn't match expectations. On launch of any process that uses the simulator (Xcode, Simulator, simctl, xcodebuild, Instruments, etc), the system first checks to see if the loaded CoreSimulatorService is the correct one for that version of Xcode. If it's not, it unloads the job and loads the correct one. After doing so, it revalidates the connection and will issue this error if the connection still doesn't meet expectations.

This usually happens when the same user account is using multiple versions of Xcode at the same time. It's perfectly fine to use one, finish, use another, finish, use yet another, etc. It's NOT ok to run two different copies at the same time.

Upvotes: 2

russbishop
russbishop

Reputation: 17239

This error is usually caused by updating or switching your version of Xcode while com.apple.CoreSimulator.CoreSimulatorService is running. Xcode (including xcodebuild) uses the Simulator to process XIB/Storyboard files when building for iOS/tvOS/watchOS so even if you don't start Simulator.app just running a build can start CoreSimulator.

This check is ensuring that the XPC service started by launchd matches the library. In your case it is failing, indicating that launchd started an older version of CoreSimulator.

If your CI system is re-using instances with multiple versions of Xcode installed you need to make sure the user session completely logs off and that no other instances of the XPC service are running before starting the next build.

If you're trying to switch between Xcode versions in the same build you'll need to insert a script to sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService 2> /dev/null after your xcode-select. Make sure Xcode, Simulator.app, and Console.app are all closed or their attempts to make an XPC connection will just make launchd restart the job immediately.

Upvotes: 1

Related Questions