Translate

Saturday, July 14, 2018

Developer tips - Visual Studio - Apple iOS erase certificates

Disclaimer !
This article is based on tests/research/finding at April 2018. Things can change.


Sometime is better to clean up the mess of certificates used by Xamarin for Apple iOS development.
Here what to do based on my experience.

Normally the certificates are generated/maintained on the Apple Developer website.



Every time a new certificate or provisioning profile is created or a current certificate (or provisioning profile) is modified, is necessary to download them on the development machine.
There, Xcode will provide to load them in a specific location and update the local keys database.

The problem is that after some time, EVERY certificate/provisioning profile generated, will be stored on the local machine. It can become very messy remember what is what.

Erase current certificates

The certificates used by Xamarin are stored in this directory : ~/Library/MobileDevice/Provisioning Profiles/

Of course this place is managed by Xcode, so ALL the certificates used by Xcode and Xamarin are here, meaning that if you erase them ALL the development on both environment will be affected !
Better do a backup just in case.  Since the names of the file in that location are ..cryptic, is not easy to know what is what.

The ideal condition when to erase everything is when you can re-obtain EVERY certificate you need to use for development from the Apple Developer website.
So let assume we can safely remove all certificates.
If you are not sure to be able to retrieve all of them, STOP NOW !


Keys

The certificates are associated with private keys stored in the local machine (app Keychain access).
It should NOT be necessary to remove also the private keys and as usual, it can be dangerous messing up with that.
However, usually is possible  to identify the involved keys.
Under the login (in the Keychain Access app) the related keys are generally marked as iPhone Developer : xxxxxxxxxx or iPhone Distribution : xxxxxxxxxxxx
Removing them will remove the private key associated to the certificate.

Restore the certificates/provisioning profile


Simply go on the Apple Developer website, go on the certificates/provisioning profile you want to have and download them on your machine.
Be sure they are marked as Active !

Then simply "open" them with the default app that should be Xcode.
That it.
Xcode will populate the directory ~/Library/MobileDevice/Provisioning Profiles/.



No comments:

Post a Comment