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

I’m currently evaluating CircleCI as a build tool for our iOS projects. I’ve thrown together a simple iOS app tested with Calabash, but the build phase is failing with a

export LC_CTYPE="en_US.UTF-8"
export XCTOOL_FORCE_TTY="true"
set -o pipefail && xcodebuild -project 'FoodTracker.xcodeproj' -scheme 'FoodTracker' clean build test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
2016-08-02 06:36:03.662 xcodebuild[704:6837] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk; its version (7.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-08-02 06:36:03.727 xcodebuild[704:6837] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk; its version (8.4) is below required minimum (9.3) for the iphonesimulator platform.
2016-08-02 06:36:03.729 xcodebuild[704:6837] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk; its version (9.0) is below required minimum (9.3) for the iphonesimulator platform.
2016-08-02 06:36:03.730 xcodebuild[704:6837] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk; its version (9.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-08-02 06:36:03.732 xcodebuild[704:6837] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk; its version (9.2) is below required minimum (9.3) for the iphonesimulator platform.
2016-08-02 06:36:11.209 xcodebuild[704:6848] CoreSimulator is attempting to unload a stale CoreSimulatorService job.  Detected Xcode.app relocation or CoreSimulatorService version change.  Framework path (/Applications/Xcode-7.3.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework) and version (209.19) does not match existing job path (/Applications/Xcode-8.0.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService) and version (285.3).
2016-08-02 06:36:11.474 xcodebuild[704:6848] Failed to locate a valid instance of CoreSimulatorService in the bootstrap.  Adding it now.
2016-08-02 06:36:11.485 xcodebuild[704:6848] *** Assertion failure in -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid], /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreSimulator/CoreSimulator-209.19/CoreSimulator/SimServiceContext.m:536
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: The loaded com.apple.CoreSimulator.CoreSimulatorService job does not match our expectations: pathOfLoadedJob: /Applications/Xcode-8.0.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc/Contents/MacOS/com.apple.CoreSimulator.CoreSimulatorService, our frameworkPath: /Applications/Xcode-7.3.app/Contents/Developer/Library/PrivateFrameworks/CoreSimulator.framework
Stack:
  0   __exceptionPreprocess (in CoreFoundation)
  1   objc_exception_throw (in libobjc.A.dylib)
  2   +[NSException raise:format:arguments:] (in CoreFoundation)
  3   -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] (in Foundation)
  4   -[SimServiceContext reloadServiceIfMovedOrAbortIfWeAreInvalid] (in CoreSimulator)
  5   -[SimServiceContext connect] (in CoreSimulator)
  6   -[SimServiceContext initWithDeveloperDir:connectionType:] (in CoreSimulator)
  7   __63+[SimServiceContext sharedServiceContextForDeveloperDir:error:]_block_invoke_2 (in CoreSimulator)
  8   _dispatch_client_callout (in libdispatch.dylib)
  9   _dispatch_barrier_sync_f_invoke (in libdispatch.dylib)
 10   +[SimServiceContext sharedServiceContextForDeveloperDir:error:] (in CoreSimulator)
 11   __60+[SimServiceContext(DVTAdditions) dvt_sharedServiceContext:]_block_invoke (in DVTiPhoneSimulatorRemoteClient)
 12   _dispatch_client_callout (in libdispatch.dylib)
 13   dispatch_once_f (in libdispatch.dylib)
 14   +[SimServiceContext(DVTAdditions) dvt_sharedServiceContext:] (in DVTiPhoneSimulatorRemoteClient)
 15   __42-[DVTiPhoneSimulatorLocator startLocating]_block_invoke (in IDEiOSSupportCore)
 16   __DVTDispatchAsync_block_invoke (in DVTFoundation)
 17   _dispatch_call_block_and_release (in libdispatch.dylib)
 18   _dispatch_client_callout (in libdispatch.dylib)
 19   _dispatch_root_queue_drain (in libdispatch.dylib)
 20   _dispatch_worker_thread3 (in libdispatch.dylib)
 21   _pthread_wqthread (in libsystem_pthread.dylib)
 22   start_wqthread (in libsystem_pthread.dylib)

bash: line 3:   704 Abort trap: 6           xcodebuild -project 'FoodTracker.xcodeproj' -scheme 'FoodTracker' clean build test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE=
       705 Done                    | tee $CIRCLE_ARTIFACTS/xcode_raw.log
       706 Done                    | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml

export LC_CTYPE="en_US.UTF-8"
export XCTOOL_FORCE_TTY="true"
set -o pipefail && xcodebuild -project 'FoodTracker.xcodeproj' -scheme 'FoodTracker' clean build test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
 returned exit code 134

Any recommendations on this? I note it’s appearing to use XCode 8 for build though I’ve requested 7.3.1 in my circle.yml:

machine:
  xcode:
    version: "7.3.1"

dependencies:
    override:
        - bundle install

test:
    pre:
        - open -b com.apple.iphonesimulator
    post:
        - cucumber
2 Likes

Hey,

this is happening because you’re launching the simulator with the open command which gets intercepted by Xcode 8 beta.

Please take a look at this thread. I’ve posted a solution there that works 100% of the time.

Best,
Constantin