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

微笑、不失礼 提交于 2020-01-10 06:17:06

问题


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.

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.

What can I do to bypass this ?

Thanks in advance.


回答1:


Apple provides an easy solution to working on multiple machines.

You can export your developer profile from your work iMac and move it onto your 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.

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

Edit:

According to Topher Fangio in the comments below, you may need to:

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.

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




回答2:


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

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

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

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




回答3:


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.




回答4:


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.

-Cheers




回答5:


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

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



来源:https://stackoverflow.com/questions/7057644/developing-for-ios-on-multiple-computers-testing-on-a-single-device-advice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!