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

Failed to initialize simulated service context #738

Closed huaqixue closed 6 years ago

huaqixue commented 7 years ago

Environment: macOS Sierra:10.12.6 Xcode: 9.0 Swift: 4.0 xctool: 0.3.3 to use command line to test: xctool -workspace myProject.xcworkspace -scheme myProjectTests -destination 'platform=iOS Simulator,name=iPhone X,OS=11.0' run-tests -only myProjectTests -sdk iphonesimulator

Error info: *** Assertion failure in -[SimulatorInfo init], /tmp/xctool-20170901-19829-1s5ox9o/xctool-0.3.3/xctool/xctool/SimulatorWrapper/SimulatorInfo.m:70

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to inialize simulated service context with error: (null)' *** First throw call stack: ( 0 CoreFoundation 0x00007fff8d2f42cb __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fffa210448d objc_exception_throw + 48 2 CoreFoundation 0x00007fff8d2f9042 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00007fff8ed41be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195 4 xctool 0x0000000108d7a6b0 -[SimulatorInfo init] + 398 5 xctool 0x0000000108d622d2 -[Options _validateDestinationWithErrorMessage:] + 65 6 xctool 0x0000000108d60ea2 -[Options validateAndReturnXcodeSubjectInfo:errorMessage:] + 104 7 xctool 0x0000000108d52a76 -[XCTool run] + 2663 8 xctool 0x0000000108d515ce main + 1208 9 xctool 0x0000000108d4c6a4 start + 52 10 ??? 0x000000000000000c 0x0 + 12

I can run tests fine with Xcode8.3.But upgrade Xcode9 ,run-tests is error.

haithngn commented 7 years ago

the same Failed to inialize simulated service context with error: (null)

Command: xctool -project Haithngn.xcodeproj -scheme HaithngnTests -sdk iphonesimulator run-tests

lemanhtien commented 7 years ago

Same error to me.

cuongnguyenta commented 7 years ago

I also have the same problem with guys :(

haithngn commented 7 years ago

Thanks iainmcgin!, It's works for now :) P/S: but -launch-timeout seem does not work Test did not run: Failed to install the test host app 'bundleid': Timed out.

ExtremeMan commented 7 years ago

I can't find a way to repro this. Whoever is experiencing this issue can you try opening simulator app before running xctool. Does it solve the problem?


open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app```
ExtremeMan commented 7 years ago

In addition, when you encounter this issue, can you run ps -eo 'tty,pid,comm' | grep -i simulator and post output here?

ExtremeMan commented 6 years ago

Please open new issue if anyone hits this again. Thanks!