设备的即席代码签名在Studio中成功,在Jenkins中失败 [英] Ad-Hoc codesigning for device succeeds in Studio, Fails in Jenkins

查看:95
本文介绍了设备的即席代码签名在Studio中成功,在Jenkins中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个支持Android和iOS的Xamarin Forms应用程序.我已经生成了Jenkins构建来编译它们.所有的Android版本均可正常工作. iOS调试版本可以正常编译.但是,Ad-Hoc版本无法完全针对iPhone目标构建.在代码签名期间似乎失败.如果我以iPhoneSimulator为目标,它将起作用,但是如果我以iPhone设备为目标,它将失败.

I have a Xamarin Forms application that supports Android and iOS. I've generated Jenkins builds to compile them. All of the Android builds work. The iOS Debug build compiles fine. The Ad-Hoc build, however, fails to build completely for an iPhone target. It appears to be failing during codesigning. It works if I target the iPhoneSimulator, but if I target iPhone device it fails.

工具/usr/bin/codesign执行以以下参数开始:-v --force --sign 81088F8E194139DC4C6CE640716944E41FB0709F --entitlements"/Users/Shared/Jenkins/.jenkins/workspace/{项目路径}/obj/iPhone/Ad -Hoc/Entitlements.xcent"-深度为"/Users/Shared/Jenkins/.jenkins/workspace/{project path}/bin/iPhone/Ad-Hoc/AppName.app" bin/iPhone/Ad-Hoc/AppName.app:错误:/Users/Shared/Jenkins/.jenkins/workspace/{项目路径}/bin/iPhone/Ad-Hoc/AppName.app:未知错误-1 = ffffffffffffffff [ /Users/Shared/Jenkins/.jenkins/workspace/{项目路径}/iDriverMobile.iOS.csproj]

Tool /usr/bin/codesign execution started with arguments: -v --force --sign 81088F8E194139DC4C6CE640716944E41FB0709F --entitlements "/Users/Shared/Jenkins/.jenkins/workspace/{project path}/obj/iPhone/Ad-Hoc/Entitlements.xcent" --deep "/Users/Shared/Jenkins/.jenkins/workspace/{project path}/bin/iPhone/Ad-Hoc/AppName.app" bin/iPhone/Ad-Hoc/AppName.app : error : /Users/Shared/Jenkins/.jenkins/workspace/{project path}/bin/iPhone/Ad-Hoc/AppName.app: unknown error -1=ffffffffffffffff [/Users/Shared/Jenkins/.jenkins/workspace/{project path}/iDriverMobile.iOS.csproj]

如果我在Jenkins工作区文件夹中的Visual Studio中打开解决方案,以便它使用完全相同的文件,则编译工作正常,这确实令人沮丧.

If I open up the Solution in Visual Studio, right in the Jenkins workspace folder so it's using the exact same files, then compilations works fine, which is really frustrating.

看看这两个输出之间的差异,似乎工作的构建(来自Studio)对所有程序集都具有AOT输出,如下所示:

Looking at differences between the two outputs, it seems that the working build (from Studio) has AOT output for all of the assemblies that looks like this:

Mono Ahead of Time编译器-编译程序集/Users/Shared/Jenkins/.jenkins/workspace/{project path}/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/OpenNETCF.Google.Analytics. dll

Mono Ahead of Time compiler - compiling assembly /Users/Shared/Jenkins/.jenkins/workspace/{project path}/obj/iPhone/Ad-Hoc/mtouch-cache/32/Build/OpenNETCF.Google.Analytics.dll

失败的构建没有这些.相反,它有几行看起来像这样:

The failing build has none of those. Instead, it has a couple lines that look like this:

MTOUCH:警告MT0095:无法将Aot文件复制到目标目录/Users/Shared/Jenkins/.jenkins/workspace/{项目路径}/obj/iPhone/Ad-Hoc/mtouch-cache/64/Build /Msym/Msym/tmp:无法启动进程. [/Users/Shared/Jenkins/.jenkins/workspace/{项目路径}/AppName.csproj]

MTOUCH : warning MT0095: Aot files could not be copied to the destination directory /Users/Shared/Jenkins/.jenkins/workspace/{project path}/obj/iPhone/Ad-Hoc/mtouch-cache/64/Build/Msym/Msym/tmp: Could not start process. [/Users/Shared/Jenkins/.jenkins/workspace/{project path}/AppName.csproj]

所有这些中最糟糕的部分是这些构建确实起作用了,但是随后我重新启动了运行Jenkins的Mac Mini,事情开始走下坡路.我无法弄清楚Studio在做什么和对msbuild的命令行调用之间的区别.它们都指向相同的二进制文件.

The worst part of all of this is that these builds did work, but then I restarted the Mac Mini that Jenkins is running on and things went downhill. I can't figure out what the difference is between what Studio is doing and the command line call to msbuild. They both point to the same binaries.

其他信息 直到今天(5/24/17)的最新更新仍然无法解决此问题.这是环境:

Additional Information This still fails with the latest updates as of today (5/24/17). This is the environment:

  • Mac OS X 10.12.5
  • 列表项
  • XCode 8.3.2
  • Xamarin.iOS 10.10.0.36
  • Visual Studio 2017 Community for Mac 7.0.1(内部版本24)
  • Mono 5.0.1.1

不能修复的问题:

  • 创建新的Jenkins版本
  • 更改Jenkins工作区路径
  • 打开整个Jenkins文件夹的权限(777)
  • 启用LLVM
  • 禁用所有链接
  • 完全卸载并重新安装Jenkins
  • 使用xbuild代替msbuild
  • 发誓很多
  • 我的中指
  • Creating a new Jenkins build
  • Changing the Jenkins workspace path
  • Opening up permissions (777) to the entire Jenkins folder
  • Enabling LLVM
  • Disabling all linking
  • Completely uninstalling and re-installing Jenkins
  • Using xbuild instead of msbuild
  • Swearing a lot
  • My middle finger

推荐答案

尝试删除应用程序DerivedData中的派生数据文件夹.根据苹果开发者论坛的的说法,它看起来像YourAPP_ dasfdsfsdafdsasfdsaf.

Try to delete the derived data folder in DerivedData of your app. It looks like YourAPP_ dasfdsfsdafdsasfdsaf, according to this from Apple Developer Forum.

DerivedData数据文件夹位于~/Library/Developer/Xcode/DerivedData/

如果这不起作用,则所有症状均指向签名证书(也称为签名身份)问题.

If this does not work, all the symptoms point to a signing certificate (also called, signing identity) issue.

似乎从命令行编译时,/usr/bin/codesign无法访问签名身份81088F8E194139DC4C6CE640716944E41FB0709F.不幸的是,可能有许多不同的原因:

It seems like when it was compiled from command line, /usr/bin/codesign can not access signing identity 81088F8E194139DC4C6CE640716944E41FB0709F. It could be many different reasons, unfortunately:

  • 钥匙串被锁定
  • codesign不允许访问签名 身份.
  • 钥匙串中存在多个身份并且签名错误 身份被选中
  • 错误的规定 个人资料已与Ad Hoc构建相匹配.
  • keychain was locked
  • codesign is not allowed to access the signing identity.
  • multiple identities exist in keychain and wrong signing identity was selected
  • Wrong provision profile was matched for Ad Hoc build.

尝试在运行msbuild之前添加以下代码段,假设您的签名身份在钥匙串~/Library/Keychains/login.keychain中:

Try to add following code snippets before running msbuild, assuming your signing identity is in keychain ~/Library/Keychains/login.keychain:

security unlock-keychain -p <password> ~/Library/Keychains/login.keychain
security set-keychain-settings -l -u -t 3600 ~/Library/Keychains/login.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k -p <password> ~/Library/Keychains/login.keychain

在构建脚本中存储钥匙串密码不是一个好主意,您可以按照

It is not a good idea to have keychain password stored in the build script, you can follow this guide to hide them.

这篇关于设备的即席代码签名在Studio中成功,在Jenkins中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆