ios – Xcode,Jenkins / SSH中的Codesign错误 – “不允许用户交互”

我试图在Jenkins上运行一个自动化的 xcodebuild,但是我遇到了错误

不允许用户交互.
命令/usr/bin/codesign失败,退出代码为1

我已经引用了“User interaction is not allowed” trying to sign an OSX app using codesign和其他类似的线程,但是没有一个解决方案似乎正确地补救了错误.

这是我已经尝试过的:

>我已经允许所有项目访问钥匙串,并且我已经专门添加了“始终允许”列表的代码(如这里完成了https://stackoverflow.com/a/22637896)
>我已经设置钥匙串不通过Keychain Access的设置通过命令自动锁定超时

security set-keychain-settings -t 3600 -l <KEYCHAIN>

我试过打电话

codesign --sign <CODE SIGN IDENTITY> --force ...

在项目编译之前(更具体来说,这个解决方案https://stackoverflow.com/a/20208104),
虽然这成功地构建了这个项目,但我不认为编译前的代码正确或可靠. (编辑:这也从jenkins运行失败)

以下是我正在执行的命令:

security unlock-keychain -p <PASSWORD> <KEYCHAIN>
xcodebuild -scheme <SCHEME> -workspace <WORKSPACE> -derivedDataPath <BUILD DIRECTORY> -configuration <CONFIGURATION> "CONFIGURATION_BUILD_DIR=<BUILD DIRECTORY>" "CODE_SIGN_IDENTITY=<CODE SIGN ID>" "PROVISIONING_PROFILE=<PROVISIONING PROFILE>" clean build

有趣的是,在机器上构建项目使用上面的命令,但是尝试通过ssh(和jenkins)运行完全相同的命令导致错误.

在此先感谢您的帮助!

解决方法

苹果不支持SSH,因为它们无头就运行自动构建,因此通过SSH运行可能是问题:

The context provided by LaunchDaemons is not supported for running GUI
applications. The SSH service,and the default setup for Jenkins,are
both implemented as LaunchDaemons. In earlier versions of Xcode 5
xcodebuild could run tests on the iOS simulator in this context,but
that was never a supported configuration,and as you have noted that
is no longer working as of Xcode 6.

Unlike LaunchDaemons,LaunchAgents provide a context where you can run
GUI applications – if the user is logged in at the time,with a window
server / Aqua session. Converting your Jenkins configuration from
being a LaunchDaemon to being a LaunchAgent would avoid the reported
issue. You can also use launchd for running tests on the iOS simulator
from a SSH session,either by crafting a LaunchAgent and manually
loading / starting that,or by using “launchctl submit”.

你试过使用web代理吗?

以上是来客网为你收集整理的ios – Xcode,Jenkins / SSH中的Codesign错误 – “不允许用户交互”全部内容,希望文章能够帮你解决ios – Xcode,Jenkins / SSH中的Codesign错误 – “不允许用户交互”所遇到的程序开发问题。

如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。