Monday, 21 September 2009

iPhone Development Provisioning on both iMac and Macbook Pro

For two weeks now I have been getting my hands dirty with iPhone / OpenGL ES 1.1 development on my iMac. A week ago my wife got me a new Macbook Pro for my birthday and we have been inseparable. Just like a kid obsessed with its new toy, I can't resist the urge to mirror any development tools and configuration that I have on the iMac into the Macbook Pro, so I can keep developing while at the same time accompanying my wife watching TV. All was good: Xcode ran properly, iPhone SDK 3.1 (Snow Leopard) installed successfully, all certificates and developer provisioning also installed, iPhone 3.0 simulator ran without any problems, and I was smiling, but not for long. Then I selected "Device - 3.0 | Debug", rebuilt the app, and it showed build failed - 1 error, which looked like this:

"Code Sign error: The identity 'iPhone Developer doesn't match any valid certificate/private key pair in the default keychain"

I was pretty sure I've installed all the certificates:
  • Development certificate
  • WWDR immediate certificate
  • Development provisioning profile 
Then I noticed something in the provisioning profile (Window > Organizer > Provisioning Profiles):

"A valid signing identity matching this profile could not be found in your keychain"

I looked for clues on the net long and hard, then I discovered the answer posted by Dave Camp:
http://www.cocoabuilder.com/archive/message/xcode/2009/7/19/29533

The answer for my problem is: I'm missing my private key!

I took the following steps to fix this problem:
  1. Exported my private key from the login keychain from iMac
  2. Shared the private key over the network, downloaded it into the Macbook, and deleted the private key so it's not stolen by someone (or just use a USB drive, safer and easier)
  3. Imported the private key into the login keychain in the Macbook (by double-clicking it). At this point it throws me some weird error but it works for sure because I can see it now in the login keychain
Voila! The build no longer returns any error!

Hope this helps some of you who encountered this same problem.

4 comments:

Alfian_Troxion said...

kabare pak

apa bikin? game yg lo bikin best banget... flox

bila mo datang ke malaysia? :D hehehe

(how is my broken indonesian :P)

Tinley Harrier said...

Thank you so much! I was having the exact same problem, just moved over to a Macbook Pro from my Mac Mini, everything was working except testing the apps on the device. I followed your instructions and now I'm good. YOU ARE THE MAN!

copet80 said...

Thanks Tinley! Glad it helped :)

Jonsi said...

Thank you man !
You saved my life !