在多台计算机上为 iOS 开发,在单个设备上测试,建议?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7057644/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:05:46  来源:igfitidea点击:

Developing for iOS on multiple computers, testing on a single device, advice?

iphoneiosxcodecertificateprovisioning

提问by Daniel

I was looking for some advice on provisioning profiles / certificates etc... I use an iMac at work to develop on, and I also sometimes find myself checking out my code from git onto my MacBook Pro at home but I always run into issues when I want to test on my iPhone from another computer.

我正在寻找有关配置文件/证书等的一些建议......我在工作时使用 iMac 进行开发,有时我还发现自己在家里将我的代码从 git 检出到我的 MacBook Pro 上,但我总是遇到问题我想从另一台计算机上测试我的 iPhone。

Obviously my provisioning profiles on the device match the certificate issued to my iMac from work, so from my laptop, I can't test on the device because the provisioning profile doesn't match a certificate. so I get a code sign error.

显然,我在设备上的配置文件与从工作中颁发给 iMac 的证书相匹配,因此在我的笔记本电脑上,我无法在设备上进行测试,因为配置文件与证书不匹配。所以我收到一个代码符号错误。

What can I do to bypass this ?

我能做些什么来绕过这个?

Thanks in advance.

提前致谢。

回答by Moshe

Apple provides an easy solution to working on multiple machines.

Apple 提供了一种在多台机器上工作的简单解决方案。

You can export your developer profilefrom your work iMac and move it onto your Macbook Pro.

您可以从您的工作 iMac导出您的开发人员配置文件并将其移动到您的 Macbook Pro 上。

  1. In Xcode 4, bring up the Organizer. Click on "Devices"/

  2. Now, click on "Developer Profiles" in the sidebar.

  3. Then, on the bottom of the screen you will see a button called "Export" and a button called "Import". On the computer with the original certificates click "export" and save the profile. You may be prompted to enter a password.

  4. On the second computer, use "import" to install the certificates.

  1. 在 Xcode 4 中,调出管理器。点击“设备”/

  2. 现在,单击侧栏中的“开发人员配置文件”。

  3. 然后,在屏幕底部,您将看到一个名为“导出”的按钮和一个名为“导入”的按钮。在具有原始证书的计算机上单击“导出”并保存配置文件。系统可能会提示您输入密码。

  4. 在第二台计算机上,使用“导入”来安装证书。

Exporting a developer profile

导出开发者配置文件

You should be able to develop and test seamlessly between the two machines now.

您现在应该能够在两台机器之间无缝地进行开发和测试。

Edit:

编辑:

According to Topher Fangioin the comments below, you may need to:

根据Topher Fangio下面的评论中的说法,您可能需要:

open Keychain Access, then find [your] iPhone Developer Certificate on my desktop, and export it. Then import it on your [second machine]. If you see the dropdown and associated private key on one machine, but not the other, then you need to export it apparently.

打开 Keychain Access,然后在我的桌面上找到 [your] iPhone Developer Certificate,然后将其导出。然后将其导入您的 [第二台机器]。如果您在一台机器上看到下拉列表和关联的私钥,但在另一台机器上没有看到,那么您显然需要将其导出。

Hopefully Topher's insight will help anyone who has trouble with using Xcode to do this.

希望 Topher 的见解能帮助任何在使用 Xcode 时遇到问题的人。

回答by Julian B.

If you're using Xcode 6.x - 8.x, there is a very easy way to do this:

如果您使用的是 Xcode 6.x - 8.x,有一种非常简单的方法可以做到这一点:

See the section titled Exporting and Importing Certificates and Profilesin the app distribution guide.

请参见标题为Exporting and Importing Certificates and Profiles应用分配导。

To sum it up:

把它们加起来:

  1. go to Xcode's preferences
  2. click on accounts
  3. click on the gear icon at the bottom left
  4. select 'export accounts' and enter the desired filename and password
  5. open the newly created file on your new machine
  1. 转到 Xcode 的首选项
  2. 点击账户
  3. 点击左下角的齿轮图标
  4. 选择“导出帐户”并输入所需的文件名和密码
  5. 在新机器上打开新创建的文件

Done! this will import the profiles from the previous machine.

完毕!这将从以前的机器导入配置文件。

回答by Nathanial Woolls

You need to keep the original private key file and certificate file you create as the absolute first step in the process on the portal. Then you need to import not just the certificate but the private key file too on your laptop. Once that is done, you should be able to sign with your developer cert and provisioning profile on both laptops.

您需要保留您创建的原始私钥文件和证书文件,作为门户上流程的绝对第一步。然后,您不仅需要在笔记本电脑上导入证书,还需要导入私钥文件。完成后,您应该能够在两台笔记本电脑上使用您的开发人员证书和配置文件进行签名。

I've gotten in this situation too. You can start it all over on the provisioning portal if needed with no real negative effects.

我也遇到过这种情况。如果需要,您可以在配置门户上重新开始它,而不会产生真正的负面影响。

回答by swift taylor

I have Xcode 4.6.1 and in the organizer there is now a refresh button at the bottom right. Hit that, sign in to your Apple account and it should pull all the relevant profile info.

我有 Xcode 4.6.1,在管理器中,现在右下角有一个刷新按钮。点击它,登录您的 Apple 帐户,它应该会提取所有相关的个人资料信息。

-Cheers

-干杯

回答by David

This answer does not seem to apply to Xcode 4.6.3 where the Organizer does not have a "Developer Profile" section.

这个答案似乎不适用于 Xcode 4.6.3,其中 Organizer 没有“Developer Profile”部分。

In Xcode 5 and 6 (which most will be using at the time of posting) there is a different procedure which is discussed here.

在 Xcode 5 和 6(大多数将在发布时使用)中,这里讨论了不同的过程。