Anyway, I had built the application like this, it resulted in an .app file:
$> xcodebuild -target "$APP_NAME" -sdk iphoneos -configuration Release
Next I signed this .app and packaged it into an .ipa file:
$> xcrun -sdk iphoneos PackageApplication -v "$APP_NAME.app" -o "$APP_NAME.ipa" --sign "iPhone Distribution"
This resulted in an error:
$> build/Release-iphoneos/$APP_NAME.app: User interaction is not allowed
The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
$> security unlock-keychain /Users/$USER/Library/Keychains/$KEYCHAIN.keychain
- replace $APP_NAME with the name of your application
- replace $USER with the name of your local user account, I used 'fred'
- replace $KEYCHAIN with the name of the target keychain, I used 'login'