Skip to content

Instantly share code, notes, and snippets.

@joncardasis
Last active March 27, 2017 17:53
Show Gist options
  • Save joncardasis/b42f34dcec4765d8f66ab75476b7e204 to your computer and use it in GitHub Desktop.
Save joncardasis/b42f34dcec4765d8f66ab75476b7e204 to your computer and use it in GitHub Desktop.
Common Issues and Resolutions to iOS CI

iOS-CI Troublshooting and Tricks

Neat Bash Snippits

Retrieve the latest simulator sdk

LATEST_SIMULATOR_SDK=$(xcodebuild -showsdks | grep "Simulator - iOS" | grep -o '\d*\.\d*' | head -n 1)

Change Jenkins from a LaunchDaemon to a LaunchAgent

This will allow Jenkins to run windowed processes like the iOS Simulator. Stop the Jenkins service and move to launch agents:

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
mv /Library/LaunchDaemons/org.jenkins-ci.plist /Library/LaunchAgents/

Remove the following lines from the moved org.jenkins-ci.plist:

<key>SessionCreate</key
<true />

Restart the Jenkins service:

sudo launchctl load /Library/LaunchAgents/org.jenkins-ci.plist

Troubleshooting Checklist

☑️ Ensure the Keychain is unlocked

Without unlocking the keychain CI users like Jenkins will not be able to access the certificates for resigning:

security unlock-keychain -p "$KEYCHAINPASS" /Users/Shared/Jenkins/Library/Keychains/login.keychain

☑️ Make sure the machine has both an iOS Developer and an iOS Distribution certificate

In order to codesign for distribution, both a developer and distribution certificate must be installed in the keychain. Codesign will not warn you of this.

☑️ Try updating Xcode

Sometimes some of the integrated libraries in Xcode can stop builds from working. Update the the latest Xcode to ensure everything is up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment