Search This Blog

Friday, January 27, 2012

XCode 4.2 the Lion is Crying...

A couple of months ago I purchased a new Mac to run Lion as well as to do Synthodeon development on.  I wanted a Lion machine to keep up with the latest Apple technologies. I also wanted it to be separate from the other machines I develop customer software on  because Lion was known to have "issues," particularly with software development, and I didn't want to be in the position of not being able to service my customers or have Lion somehow pollute my products.

(This is easy to see by simply moving a relatively complex piece of software in XCode from 3.2.6 to 4.2 on Lion.  Magically thousands of errors appear and currently working applications (that compile with no errors on 3.2.6 or even 4.0) won't even compile at all.  I can see it now, "Why yes, Mr. Visa provider, your mail won't go out until I can debug my new Mac/Lion/XCode world..."  Even in .NET things are better than this...)

I've been sidetracked from Mac development for a couple of months.  An eternity in "Apple Land" - numerous software releases (on both iOS and Lion) have come and gone and I am still sitting in the now distant (epochs ago) past. 

Worse, its been so long that my last developer profile expired as well.

Lastly, I upgraded my machine and OS to Lion.

So no problems with old XCode 4.0 projects on Lion - they do build and seem to work in the Simulators - but I am working on something more complex that involves porting code and other complexities.

So now its time to test my latest work on an actual iOS device...

And all hell breaks loose.

Nothing will work, bizarre KeyChain and other Organizer errors - "Oh No! You're Super Secret Magic Encryption Key Failed to Validate!!!" and so on.  In actuality "Valid signing identity not found” and "XCode could not find a valid private-key/certificate pair for this profile in your KeyChain."

Huh?

Little red (!) things by each provisioning item in the Organizer.

So after some head scratching I figure that its a new machine, right?  So initially I figure I probably need to go to the iOS Apple Developer portal and create a new .mobileprovision file.

I do but no dice - still "Oh No!" errors...

I am not alone...

This.

This.

So after some tinkering and an hour of Googling I resolve the issue.

Start over with setting things up.  (Warning - I am a small developer with a few machines for which doing this is not a problem.)

1. Log onto the iOS Provisioning Portal.

2. Choose "Certificates" on the upper left.

3. Given a new machine, expired provisioning portals, etc. I simply "Revoked" the existing Certificate.  You then have to "Apply" for a new one (this is instantaneous I guess - but you have to refresh the browser to see it).

4. You have to download this and load it into KeyChain by clicking on it (steps here).

5. Then you have to re-provision each device.

There will be a lot of "download" and "click on" things to do during this because somehow the KeyChain app works in different ways depending on the different Certificates.

I had to restart XCode and KeyChain a couple of times.

And then, in the end, you have to make sure that you've set up the right Scheme in XCode.

I finished and it finally displayed no Organizer errors but nothing worked.  The first time it was some issue where the real errors just stopped coming out.  The second time it built for 5.0 but my iPad had 4.3.5 on it and the errors made it appear as if the Certificate and provisioning munging had failed...


No comments:

Post a Comment