用于签署 iPhone 应用程序的配置文件名称?
我编写了一个脚本,使用 xcodebuild
生成 iPhone 应用程序的 AdHoc 构建。
我想编辑此脚本以输出用于签署构建的配置文件的名称。
这将允许我将配置文件包含在自动生成的 zip 中。这样,我可以自动将存档发送给 AdHoc 测试人员,并确保他们拥有正确的配置文件来安装应用程序。
有没有办法提取用于签署应用程序的配置文件名称或文件:
- 从 Xcode 项目构建和签名的应用程序中
- (我不想手动解析 project.pbxproj 文件,因为此解决方案可能会在下一个 Xcode 更新中中断)
- 任何其他可编写脚本的方式
不可原谅 建议使用命令security
来获取用于签署应用程序的证书的名称。获得此信息后,是否有任何方法可以找到配置文件的名称?
这是我尝试过的:
遗憾的是,构建期间 xcodebuild 的输出不包含此信息。在 CodeSign 步骤中,有一行:
/usr/bin/codesign -f -s "iPhone Distribution: My name" ...
但我无法将其与证书匹配。
我研究了使用协同设计,并且命令
/usr/bin/codesign -d -vvv --entitlements - -r - /Users/lv/Desktop/TicTacBoo.app/TicTacBoolooked promising, but it doesn't give me the information I need.
I haven't found any useful option in xcodebuild either.
I wrote a script that uses xcodebuild
to generate an AdHoc build of an iPhone application.
I would like to edit this script to output the name of the Provisioning Profile used to sign the build.
This would allow me to include the Provisioning Profile in the zip that is automatically generated. This way, I could automatically send the archive to the AdHoc testers and be sure that they have the right Provisioning Profile to install the app.
Is there any way to extract the Provisioning Profile name or file used to sign the application:
- from the builded and signed application
- from the Xcode project (I don't want to manually parse the project.pbxproj file, as this solution might break in the next Xcode update)
- any other way that is scriptable
Unforgiven suggested to use the command security
to get the name of the certificate used to sign the app. Once you have this information, is there any way to then find the name of the Provisioning Profile?
Here is what I tried:
Sadly, the output of xcodebuild during the build does not contain this information. During the CodeSign step, there is the line:
/usr/bin/codesign -f -s "iPhone Distribution: My name" ...
but I can't match this with a certificate.
I looked into using codesign, and the command
/usr/bin/codesign -d -vvv --entitlements - -r - /Users/lv/Desktop/TicTacBoo.app/TicTacBoo
looked promising, but it doesn't give me the information I need.
I haven't found any useful option in xcodebuild either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以从终端使用“security”命令;不幸的是,至少在我的带有 Snow Leopard 的 MBP 上,它似乎会导致您需要发出的命令之一出现分段错误。有关更多信息,请从终端发出
无论如何,假设您的开发/生产证书存储在登录钥匙串中,您可以尝试以下操作:
第二个命令导致分段错误(由 -c 参数引起),但它应该是正是您所需要的。或者,您可以用来
获取可用于对应用程序进行代码签名的所有有效证书的列表。
对于每个证书,输出还包含 SHA1 消息摘要,以便您可以轻松地在钥匙串中搜索与“iPhone Distribution: Your name”关联的 SHA1 摘要匹配的证书。然而,这要求您使用钥匙串 API 编写自己的应用程序。
请告诉我这是否适用于您的 Mac,或者您是否遇到相同的分段错误问题。
编辑/更新:我已经在其他机器上验证了该错误并向 Apple 提交了错误。
You can use the "security" command from the terminal; unfortunately, at least on my MBP with Snow Leopard it appears to cause a segmentation fault in one of the commands you need to issue. For more information, issue from the terminal
Anyway, here is what you can try, assuming your development/production certificates are stored in the login keychain:
The second command causes the segmentation fault (caused by the -c argument), but it should be exactly what you need. Alternatively, you can use
to get a list of all of the valid certificates you can use to code sign your applications.
For each certificate, the output also contains the SHA1 message digest, so that you can easily search the certificate in the keychain matching the SHA1 digest associated to "iPhone Distribution: Your name". This however, requires that you write your own application using the keychain APIs.
Let me know if this works on your mac or if you experience the same segmentation fault issue.
EDIT/UPDATE: I have verified the bug on other machines and filed a bug to Apple.
如何在(构建的应用程序的)_CodeSignature/CodeResources plist 文件中查找“mobileprovision”类型的文件?
这是使用 defaults(1) 读取 plist 文件的方法。您必须将 CodeResources 文件复制到带有“.plist”后缀的文件中,以保持默认值满意...
(在我的测试用例中,那里有 2 个 .mobileprovision 条目;忽略名为“embedded.mobileprovision”的条目)
How about looking in the _CodeSignature/CodeResources plist file (of the built application) for files of type "mobileprovision"?
Here's a way to do that using defaults(1) to read the plist file. You have to copy the CodeResources file to something with the ".plist" suffix to keep defaults happy...
(in my test case, there were 2 .mobileprovision entries there; ignore the one named "embedded.mobileprovision")
配置配置文件已在应用程序中。您的 zip 文件中不需要另一个副本(除非您的测试人员不了解如何在应用程序内部使用该副本。)
它的名称为
YourApplication.app/embedded.mobileprovision
这不会回答你的问题是因为原始文件名丢失了,但它似乎确实解决了你更大的问题。
The provisioning profile is already in the application. You don't need another copy in your zip file (unless your testers do not understand how to use the copy inside of the application.)
It's named
YourApplication.app/embedded.mobileprovision
This doesn't answer your question because the original filename is lost, however it does seem to solve your bigger problem.