xcodebuild如何使用命令行对应用程序进行签名? [英] xcodebuild how to sign app with command line?

查看:282
本文介绍了xcodebuild如何使用命令行对应用程序进行签名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令行导出ipa,我无法在Xcode中执行此操作,因为该应用是为客户端开发的,而且我不是他的团队的成员(我真的希望Apple能够做到这一点并做出改变就像在Xcode 5中一样:/)

I am trying to export an ipa using the command line, I can't do that within Xcode because the app is made for a client and I am not a member of his team (I really hope Apple changes that and makes it work like in Xcode 5 :/ )

无论如何,我做了更多的研究并尝试了以下命令:

Anyway, I did more research and tried this command:

xcodebuild -exportArchive -archivePath pcdev.xcarchive -exportPath ~/Desktop/playcadeAdHoc.ipa -exportFormat ipa -PROVISIONING_PROFILE= xxxxxxx-8a61-4264-8fe9-0513bd7935e6 -CODE_SIGN_IDENTITY=iPhone Developer:xxxxx

它确实导出了.ipa,但是我无法在手机上运行它。我陷入了安装状态。我遍历了命令的日志,我认为这是导致问题的原因:

It did export the .ipa but I wasn't able to run it on my phone; I was stuck in the installing state. I went through the logs of the command and I think this one is causing the problem:


检查原始应用程序




  • / usr / bin / codesign --verify -vvvv / var / folders / ks / gxlbsszj7t58y5n6z8d1hpcm0000gn / T / 7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4 /games.app
    程序/ usr / bin / codesign返回了1:[/var/folders/ks/gxlbsszj7t58y5n6z8d1hpcm0000gn/T/7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4/games.app:
    a密封资源丢失或
    文件丢失:/private/var/folders/ks/gxlbsszj7t58y5n6z8d1hpcm0000gn/T/7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4/games.app/archived-expanded entitlements.xcent
    ]

协同设计检查失败:
/ var / folders / ks / gxlbsszj7t58y5n6z8d1hpcm0000gn / T / 7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4 / games.app:
a密封的资源丢失或文件无效:
/ privat e / var / folders / ks / gxlbsszj7t58y5n6z8d1hpcm0000gn / T / 7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4 / games.app / archived-expanded-entitlements.xcent

Codesign check fails : /var/folders/ks/gxlbsszj7t58y5n6z8d1hpcm0000gn/T/7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4/games.app: a sealed resource is missing or invalid file missing: /private/var/folders/ks/gxlbsszj7t58y5n6z8d1hpcm0000gn/T/7F8E1EF2-5238-4EC6-AE74-CDEC6C082A76-2731-00000AE5DF0617E4/games.app/archived-expanded-entitlements.xcent

我确定使用了正确的配置和代码签名名称,同样在Xcode中,我将方案存档设置更改为debug而不是release,以便使用即席和开发身份。

I am sure that am using the correct provisioning and code signing name, also in Xcode I changed the scheme archive setting to debug instead of release in order to work with adhoc and development identity.

我使用Apple工具的经验非常有限,因此请尝试尽可能多地解释该解决方案。

My experience with Apple tools is very limited so please try to explain the solution as much as possible.

编辑:
我也尝试过这种方法,它不会给我带来任何错误,但仍将应用程序堆叠在安装中...:

I also tried this method it doesn't gave me any error but still the app is stacked in "installing...":

xcrun -sdk iphoneos PackageApplication ~/Desktop/finalX.xcarchive/Products/Applications/games.app -o ~/Desktop/playcadetest.ipa --sign "iPhone Developer: Name Name (xxxxxxxx)" --embed ~/Desktop/p/adhoc.mobileprovision

谢谢

推荐答案

事实证明我使用了错误的命令;特别是这部分是错误的:

It turns out that I was using the wrong commands; specifically this part is wrong:

-PROVISIONING_PROFILE= xxxxxxx-8a61-4264-8fe9-0513bd7935e6 
-CODE_SIGN_IDENTITY=iPhone Developer:xxxxx

正确的是:

-exportProvisioningProfile "Provisioning profile full name "

提供配置文件全名与Xcode中出现的名称相同,而不是UDID(我不知道为什么很多人建议这样做),也不需要指定签名身份。

Provisioning profile full name is the same name that appear in Xcode, not the UDID (I don't know why many people suggested that) also there is no need to specify the signing identity.

无论如何,这是现在对我有用的完整命令行:

Anyway, here is the full command line that is working for me now:

xcodebuild -exportArchive -archivePath myArchive.xcarchive -exportPath myApp.ipa -exportFormat ipa -exportProvisioningProfile "Provisioning profile full name"

注意:


  • 将归档文件复制到文件夹后,我正在运行此命令
    (桌面),然后将终端位置更改为该文件夹( cd
    桌面
    ),然后运行命令

  • 同样不要忘记根据归档构建配置(发布或调试)来更改供应配置文件,您可以将其从方案设置更改为进行调试或发布构建。

  • I am running this command after copying the archive in a folder (desktop) then changing the terminal location to that folder (cd desktop) and then running the command
  • Also don't forget to change the provisioning profile based on your archive build configuration (release or debug), you can change that from the scheme setting to either make a debug or a release build.

这篇关于xcodebuild如何使用命令行对应用程序进行签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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