I am trying to run iOS tests with xcodebuild commands over ssh. When I try to run those commands which build and run the iOS UI Tests I am facing following error.
Note: I have all the keychains on the machine where I ssh in unlocked.
Command
HOME=/Users/mcj xcodebuild build-for-testing -project ios/ios_test_app/HXKPIIOS/HXKPIIOS.xcodeproj -scheme HXKPIIOS -destination 'platform=iOS,id=d623bacb04507071723fe1286c148edb822d5422' -derivedDataPath /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data| tee /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/uitest/build1.log
Error
/usr/bin/codesign '-r-' '--display' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: code object is not signed at all
Codesigning /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib: unknown error -1=ffffffffffffffff
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' '<code sign identity>' '--verbose' '/opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app/Frameworks/libswiftCore.dylib'
}
** TEST BUILD FAILED **
The following build commands failed:
CopySwiftLibs /opt/HXKPI_Logs/oobe_iOS_2018-06-14-11-14-23-216414/build_derived_data/Build/Products/Debug-iphoneos/HXKPIIOS.app
(1 failure)
My guess is that although you have the proper items within your Keychain it still needs to be unlocked before it can execute the build process properly. When ssh
in (before building) try:
$ security unlock-keychain
If your keychain is not unlocked, it needs a window server connection in order to prompt the user to unlock the keychain. Use security(1) to unlock the keychain on the remote machine prior to executing the xcodebuild.
If that doesn't work for you please review this question and subsequent answers.