如何生成可供客户自行签名的 iOS 发布版本?
我的场景
我为客户编写了一个 iOS 应用程序。该项目即将结束,现在是时候将其放入 App Store 了。在整个开发过程中我一直向他们发送开发版本。这些构建有一个基于我的公司和我客户的项目的捆绑包 ID,如下所示:com.mycompany.clientname.projectname
。我使用在自己的 Provisioning Portal 帐户中创建的 Ad Hoc Distribution Provisioning Profile 签署了这些 Ad Hoc 构建。
现在是时候去 App Store 了,我需要进行发布构建并将其发送给他们,以便他们使用自己的 App Store 分发配置文件进行签名。这也意味着为项目设置一个新的 Bundle ID。
我的问题
我需要向客户端提供编译后的应用程序,以便他们使用其配置文件进行签名。但是,我需要将 Bundle ID 设置为他们首先要使用的内容。假设它是 com.bestclientever.appname
。 Xcode 4 现在不允许我存档项目,因为这样做需要代码签名。我无法对它进行代码签名,因为我无法创建与他们在配置门户中设置的捆绑包 ID 相同的配置配置文件(配置门户强制执行唯一性 - 正如它应该的那样)。
我在这里是否做出了任何错误的假设或误解? IE。我真的必须将 Bundle ID 设置为他们要签名的内容吗?
问题
有没有办法在不进行代码签名的情况下存档或以其他方式构建 iOS 应用程序?比如“稍后签名”设置之类的?
或者,有没有一种方法可以使用一个捆绑包 ID 构建应用程序,然后其他人可以使用另一个捆绑包 ID 的配置文件对其进行签名(通过更改已编译应用程序的捆绑包 ID 或其他某种签名方法)?
我如何构建最终发布版本,但让其他人签署应用程序以分发到 App Store?
我尝试或探索过的内容
- 代表客户。
- 对于其他不太懂行的客户,我最终只是获得了他们的 Provisioning Portal 和 iTunesConnect 凭据,并像他们一样进行了最终构建。这对这个客户来说是行不通的。这是一家大公司,有严格的安全准则和大量繁文缛节。
- 欺骗作为客户。
- 这与上面的类似,但由于相同的原因而不起作用。询问我的客户“您可以导出您的私钥并将其发送给我”听起来真的很可疑吗?此答案中描述了此技术:如何将 iOS 应用发送给客户端,以便他们进行代码签名
- 向客户发送我的项目源代码并让他们进行发布构建。
- 我们的协议中没有源代码的许可。此外,该客户不想参与源代码(因此将其外包)。我会将此作为最后的选择,但一定有更好的方法!
- 在开发者会员中心设置为管理员级开发者。
- 不幸的是,只有代理级别的用户才能创建配置文件(据我所知)。似乎应该有一种方法可以让我创建一个可用于签署构建的配置文件或为我生成一个配置文件。我找不到任何一个选项。
My scenario
I wrote an iOS app for a client. The project is almost over and now it's time for them to put it in the App Store. I've been sending them development builds throughout the development process. Those builds had a bundle id based on my company and my client's project like so: com.mycompany.clientname.projectname
. I signed those Ad Hoc builds with an Ad Hoc Distribution Provisioning Profile that I created in my own Provisioning Portal account.
Now that it's time to go to the App Store, I need to do a Release Build and send that for them to sign with their own App Store Distribution Provisioning Profile. This also implies setting a new Bundle ID for the project.
My problem
I need to get a compiled app to the client for them to sign with their provisioning profile. However, I need to set the Bundle ID to what they're going to use first. Let's say it's com.bestclientever.appname
. Xcode 4 won't let me archive the project now because doing so requires code signing. I can not code sign it because I can not create a provisioning profile with the same Bundle ID as what they have set up in their Provisioning Portal (the Provisioning Portal enforces uniqueness—as it should).
Have I made any incorrect assumptions or misunderstandings here? ie. Do I really have to set the Bundle ID to what they're going to sign with?
The Question
Is there any way to archive, or otherwise build, an iOS app without code signing it? Like a "sign later" setting or something?
Or, is there a way to build the app with one bundle id but then someone else be able to sign it with a provisioning profile for another bundle id (either by changing the bundle id of the compiled app or some other signing method)?
How can I build the final release build but have someone else sign the app for distribution to the App Store?
What I've tried or explored
- Acting for the client.
- With other, less savvy clients, I've ended up just getting their Provisioning Portal and iTunesConnect credentials and just doing the final build as them. That won't fly with this client. It's a big company with strict security guidelines and a lot of red tape.
- Spoofing as the client.
- This is similar to the one above and won't work for the same reasons. It sounds really fishy to ask my client "can you export your private keys and send them to me"? This technique is described in this answer: How can I send iOS app to client, for them to code-sign
- Sending the client my project source code and letting them do the release build.
- A license to the source code was not in our agreement. Additionally, this client does not want to get involved with source code (hence outsourcing it). I would entertain this as a last-resort option, but there's gotta be a better way!
- Getting set up as an Admin-level developer in their Developer Member Center.
- Unfortunately, only the Agent-level user can create a Provisioning Profile (as far as I can tell). It seems like there ought to be a way to either let me create a profile that I can use to sign the build or generate a profile for me. I can't find either option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
大多数答案看起来很复杂而且已经过时了。我认为简单的答案是使用开发者配置文件进行存档。
这是我目前正在出于自己的目的进行研究的解决方案(未经过充分测试):
您只需要开发人员访问其帐户(而不是团队代理)并创建一个开发配置文件,该配置文件授权您构建指定的应用程序 ID(您需要指定应用程序 ID,因为它会被编译)。然后使用开发配置文件存档应用程序,并与您的客户共享存档。然后,他们可以使用自己的分发配置文件重新签署存档。
一个复杂的情况是,当您使用开发人员配置文件构建存档时,权利属性 get-task-allow 会设置为 true,但需要设置为 false 才能进行分发,因此您必须通过手动将其设置为您的权利来解决此问题.plist - 在这里查看我的问题:我可以通过开发人员存档吗证书,然后在提交时使用分发证书重新签名?
Most of these answers seem complicated and out dated. I think the simple answer is to make an archive with a Developer profile.
This is a solution which I am currently investigating for my own purposes (not fully tested):
You just need developer access (not team agent) to their account and create a Development provisioning profile that authorizes you to build the specified App ID (you need to specify the App ID, because it gets compiled in). Then Archive the app with the Development profile, and share the archive with your client. They can then re-sign the archive with their own Distribution profile.
One complication is that when you build an archive with a developer profile, the entitlement attribute get-task-allow gets set to true, but needs to be set to false for distribution, so you have to work around that by setting it manually your Entitlements.plist - see my question here: Can I archive with a Developer certificate, then re-sign it during submission with a Distribution certificate?
我刚刚在 WWDC 2012 上确认以下技术有效。它最好地满足了我的限制:客户参与少、客户专业知识低、签名过程简单以及源代码所有权。
这确实需要客户端使用developer.apple.com 上的会员中心并使用Xcode 一点点(但只是管理器!)。如果您的客户在这个级别上存在技术能力问题,那么我建议您接管并为他们做这件事(并收费!)。询问他们的开发人员登录名和密码,然后代表他们行事,就像您是员工一样。
编者注:交换密钥是一个可怕的妥协,因为它对客户来说更具技术性和参与性,而对开发人员来说则更具黑客性和风险。考虑到这两个更好的选择,它应该被视为不可选择。
I just confirmed at WWDC 2012 that the following technique works. It best satisfies my constraints of little client involvement, low client expertise, a simple signing process, and source code ownership.
This does require the client to use the Member Center on developer.apple.com and to use Xcode a little bit (but just the Organizer!). If your client has technical capability problems at this level then I recommend just taking over and doing it for them (and charging for it!). Ask for their developer login and password and just act on their behalf as if you were an employee.
Ed note: Trading keys around is a terrible compromise because it's more technical and involved for the client and more hacky and risky for the developer. It should be considered a non-option given these two better options.
我也有同样的问题。这就是我最终解决它的方法:
客户并不那么关心共享开发证书,因为他们会共享他们的分发证书。
我还必须创建 entitlements.plist,并将“可调试”(get-task-allow) 设置为“否”,并在构建配置中引用它(在“代码签名”、“代码签名权利”下)。
I had the same problem. This was how I finally solved it:
The client was not so concerned with sharing a development certificate as they would be sharing their distribution certificate.
I also had to create
entitlements.plist
with "Can be debugged" (get-task-allow) set to NO, and reference it in the build configuration (under Code Signing, Code Signing Entitlements).我相信我已经找到了一种方法来完全满足您的要求,我没有进行广泛的测试或尝试上传到应用程序商店,但从我所做的测试来看,它似乎很好。我的配置文件的退出和添加正在运行,因为我可以将其安装在 AdHoc 配置文件中定义的设备上,无需手动安装配置文件。第二个测试是我从 xCode 获得了具有相同捆绑包 ID 的 iPad 和 iPhone 版本的应用程序,起初我无法在 iTunes 中同时安装这两个应用程序,但在辞职和捆绑包 ID 更改后,我能够同时安装这两个应用程序。我还尝试更改应用程序名称,效果也很好,它以新名称显示在设备和 iTunes 中。下面是我的脚本,它旨在为我退出特定的应用程序,因此配置文件和bundleID是硬编码的。我在应用程序的 iPhone 和 iPad 版本之间切换,因此我将其作为参数添加到脚本中。但你应该能够接受我在这里提出的原则并为自己完善它们。
这篇文章的核心内容是建立在 Further Adventures in resigning for iOS from Dan's Dev Diary 等文章的基础上的,与 Erica Sadun 的文章非常相似上面列出的应用程序签名者。我所做的主要补充是在辞职之前编辑 Info.plist。
I believe I have found a way to do exactly what you want, I haven't done extensive testing or tried to upload to the app store but from the testing I have done it seems to be good. The resign and the addition of my provisioning profile is working as I can install it on my devices defined in the AdHoc profile with no manual profile installation needed. Second test was I got an iPad and an iPhone version of an app with the same bundle ID from xCode, at first I could not have both in iTunes but after the resign and bundle ID change I was able to have both installed. I also tried changing the app name and that worked as well, it showed on the device and in iTunes with the new name. Below is my script, it's designed to resign a specific app for me, so the profile and bundleID are hardcoded. I flip between an iPhone and iPad version of the app so I added that as a parameter to the script. But you should be able to take the principles I have here and refine them for yourself.
The guts of this builds upon articles like Further adventures in resigning for iOS from Dan's Dev Diary and very similar to Erica Sadun's App Signer listed above. The main addition I made was the editing of the Info.plist prior to resigning.
最好的替代方法是要求客户将其分发证书私钥导出到 .p12 文件中,并将其与分发配置文件一起发送给您,您可以使用该分发配置文件为您的客户生成 App Store 分发版本。
祝你好运!
问候,
山姆
Best alternative way would be to ask the client to export his distribution certificate private key into .p12 file and send it across to you alongwith the distribution profile with which you can generate a App Store distribution build for your client.
Best of luck!!
Regards,
Sam
好的,找到了一种无需共享配置文件或证书的方法。
这个想法是插入一个“运行脚本”构建阶段来欺骗XCode签署一个它没有编译的应用程序,这样你就可以将一个编译的(未签名的)应用程序发送到客户端,然后他们的XCode用他们的证书和签名来签署该应用程序轮廓。
如何做到这一点:
第 1 步:让 XCode 生成一个未签名的 Release .app(我将其称为“App A”)。请参阅此处的“禁用代码签名”:https://stackoverflow.com/a/10171462/375486
步骤2:创建一个新的 XCode iOS 项目并从中删除所有可以的构建阶段,因此它会创建一个空的 .app 文件(我将其称为“App B”)
第 3 步:向项目 B 添加“运行脚本”构建阶段,将“应用程序 A”的内容复制到“应用程序 B”中。在我的例子中,我使用了这个:
第 4 步:将“B”XCode 项目以及所有必要的文件发送给客户。
第5步:客户端构建B项目。在后台,XCode 将运行“运行脚本”命令,然后对生成的应用程序进行签名,客户端将获得完美签名的应用程序。
就是这样:)
Ok, found a way to do it without sharing provisioning profiles or certificates.
The idea is to insert a "run script" build phase to trick XCode into signing an App it didn't compile, so you can send a compiled (unsigned) App to the client, and then their XCode signs that App with their cert and profile.
How to do it:
Step 1: Make XCode generate an unsigned Release .app (I'll call this "App A"). See "To Disable Code Signing" here: https://stackoverflow.com/a/10171462/375486
Step 2: Create a new XCode iOS project and remove from it all build phases you can, so it creates an empty .app file (I'll call this "App B")
Step 3: Add a "run script" build phase to Project B which copies the contents of "App A" into "App B". In my case I used this:
Step 4: Send the "B" XCode project to the client, with all the necessary files.
Step 5: The client builds the B project. Under the hood, XCode will run the "run script" command, then sign the resulting app, and the client gets a perfectly signed App.
And that's it :)
iResign 效果很好。
它允许您在签名时更改捆绑 ID 并添加权利。可能适合您的用例。
话虽这么说,xcarchive 解决方案更加规范。请注意,共享 xcarchive 文件会为他们提供 dsym。
如果您的代码中有任何 #ifdef DEBUG 语句,请确保它们在您提供的构建中被禁用。
iResign works quite well.
It allows you to change the bundle id and add entitlements when signing. Probably would work for your use case.
That being said, the xcarchive solution is more canonical. Be aware that sharing the xcarchive file gives them the dsym.
If you have any #ifdef DEBUG statements in your code, make sure they are disabled in the build you give them.
呵呵,所有这些看起来都比实际要复杂得多。我用这个:
Huh, all these look way more complicated then they have to. I use this this:
我去过那里。选项2或3是没有问题的。选项 4 是理想的选择,但正如您所写,Apple 不会让代理委托她创建分发配置文件的权限。
所以基本上,您唯一的选择是获取使用他们的帐户定义的分发配置文件。为了让您处理它,您需要以他们的代理身份登录,但这不是一个选项。
所以他们必须这么做。没有办法解决这个问题。
他们还必须邀请您作为他们帐户的产品开发团队的成员。您需要成为管理员。这意味着您必须按照 Apple 的规定发送签名证书请求。
最后,他们必须下载并向您发送他们创建的分发配置文件。
有了这些,您将能够使用他们的资源签署您的应用程序。
I've been there. Options 2 or 3 are out of question. Option 4 would be ideal, but as you wrote, Apple will not let the agent delegate her privileges to create distribution profiles.
So basically, your only option is for you to get the distribution profile defined with their account. In order for you to handle it, you would need to login as their agent, which is not an option.
So they will have to do it. There is no way around that.
They will also have to invite you as a member of their product development team on their account. You will need to be an admin. That's mean you will have to send a signing certificate request as outlined by Apple.
Finally, they will have to download and send you the distribution provisioning profiles they created.
With all that, you will be able to sign your application with their resources.
我刚刚和苹果通了电话。他们说这是唯一的方法:
https://developer.apple.com/library/ios/#qa /qa1763/_index.html
客户将您添加到他们的团队中,并授予您特定的权限。
I just got off the phone with Apple. They say this is the only way to do it:
https://developer.apple.com/library/ios/#qa/qa1763/_index.html
The client adds you to their team, and gives you specific privileges.