Friday, June 24, 2011

Bataan death march resumed - submitting an app

Ok. We are a day and 1/2 into this, and no end in sight. The fr***kn f*cd Up app submission process is even worse than I anticipated. What are all these certificates? What are all these provisions? Why did I get a fr*gging error message stating it couldn't find a provisioning file for my app, causing me to have to recreated a whole new app?

Ok. Relax. Calm is the order of the day. You just at least got the release build to work. That's something to build on. You also now have a valid public/private key in the client's name. Anything else? You have a developer provision profile in his name. Not that that matters. My concern is that there will be some name collision with the new app name.

Now - let's try again with the new app name. Or, maybe, the old app name?

No, you created the developer provision profile and certificate under the new name. Didn't you? No, you didn't.

Ok, I'm trying to avoid this problem again:

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

Which happenned when my signing identity for the app-store provisioning profile didn't match.

Well, I've created a new one cly 4 - for the developer. That a public/private key, and I want to sign with the private key. None of my certs nor his previous certs or profiles re there. So, I'm definitely going with the new app.

O.k. Let's try the Bataan death march again:

http://developer.apple.com/ios/manage/distribution/index.action

Ok, so that's the one with this Bataan death march sequence:

Obtaining your iOS Distribution Certificate
Create and download your iOS Distribution Provisioning Profile for App Store Distribution
Creating and Downloading a Distribution Provisioning Profile for Ad Hoc Distribution
Building your Application with Xcode for Distribution
Verifying a Successful Distribution Build
Updating your Application


Ok, now I need to generate the *distribution* certificate.

Generating a Certificate Signing Request
To request an

iOS Distribution Certificate,

you first need to generate a Certificate Signing Request (CSR) utilizing the Keychain Access application in Mac OS X Leopard.

The creation of a CSR will prompt Keychain Access to simultaneously generate your public and private key pair establishing your iOS Distribution identity.

// Deja vu

in your Applications folder, open the Utilities folder and launch Keychain Access.

// done

In the Preferences menu, set Online Certificate Status Protocol (OSCP) and Certificate Revocation List (CRL) to “Off”.

// done

Choose Keychain Access -> Certificate Assistant -> Request a Certificate from a Certificate Authority.

// this is to request a certificate for my clients IOS Distribution Certificate

Note: If you have a private key highlighted in the Keychain during this process, the resulting Certificate Request will not be accepted by the Provisioning Portal.

Confirm that you are selecting “Request a Certificate From a Certificate Authority...” and not selecting “Request a Certificate From a Certificate Authority with …”

// Ok, I have 3 certificates - one developer for cly, one dev and one dist. for myself.


// Ok, I called the cert clycardistcert1.certsingingrequest

In the User Email Address field, enter your email address. Please ensure that the email address entered matches the information that was submitted when you registered as an iOS Developer.


In the Common Name field enter your Company/Organization/Department name. Please ensure that the name entered matches the information that was submitted when you registered as an iOS Developer.

// Oops..

Ok, I have to confirm with the client what name he put in here.


Ok, I have the name I'm sure he had, it's displayed in the iOS developer's portal.


// Ok, let's try that again.

// Ok, saved it with "cert5" in the certsingingrequest

// Next up:

Your private key is stored in the login Keychain by default and can be viewed in the Keychain Access application under the ‘Keys’ category. To generate a CSR:

Submitting a Certificate Signing Request for Approval
After creating a CSR, log in to the iOS Provisioning Portal and navigate to ‘Certificates’ -> ‘Distribution’ and click the ‘Add Certificate’ button.

// ok, there's one already there. Revoking. Now clicking the "Request Certificate" button.


Click the Upload file button, select your CSR and click ‘Submit’. If the Key Size was not set to 2048 bits during the CSR creation process, the Portal will reject the CSR.
Approve your iOS Distribution Certificate.


// ok, that's done.

What about this:

*If you do not have the WWDR intermediate certificate installed, click here to download now.

I did it once. But, did I uninstall it? Let's look at keychain

Nothing.

Ok, by arranging download by dates, I found the file.

AppleWWDRCA-1.cer

What am I supposed to do with it?

Here's something:

In the ‘Certificates’-->’Distribution’ section of the Portal,

Control-Click the WWDR Intermediate Certificate link

and select “Saved Linked File to Downloads” to initiate download of the certificate.

// I just downloaded it.

After downloading, double-click the certificate to launch Keychain Access and install.

// Let's try it.

// how do I know it's installed?

// Ok, it's got to be the certificate
// "Apple WorldWide Developer Relations Certification Authority".
// Remember, this is from the *distribution* tab of the *provisioning portal*.


// Under key, in the KeyChain Access, we already have a "cc cert4" public private
// key with and iphone developer certification (signed by it?)

Also, a simple Clay Carson Public Private key pair. What is that; where is it from? Is it the one I just created? How did it get in there?

That's why I wanted to use different names - but of course, they make you enter the vanilla name; and then don't have you a way to distinguish between keys.

There's also clrdist1 as a pub/priv key pair. Let's continue.

In the same area of the Provisioning Portal, click on the name of the iOS Distribution Certificate to download.

On your local machine, double-click the downloaded .cer file to launch Keychain Access and install your certificate.

I remember naming the 1; but was it before or after the 4? Sugar. I wish I were more detailed. This stuff is so detailed and tricky. Not my strong point.


The 4 was the developer. I think I was looking at a different display. My certificates is the least confusing. It shows the certificate, and the private key they were signed by. E.g. cly's developer cert was signed by cly cert 4's private key.

Theory: the mere act of creating the certificate request creates the pub/private pair for the cert in the keychain.

How else would dist cert1 and the gener clay carson get there?

// ok - where are we. We're marching through Bataan.

The preparation part:

p://developer.apple.com/ios/manage/distribution/index.action

We're finishing:

Downloading and Installing iOS Distribution Certificates

Which already seems to have been created by *requesting* it, but whatever.


I'm copying it in as distribution-identity-2.cer.

In the same area of the Provisioning Portal, click on the name of the iOS Distribution Certificate to download.

Ok. when I do this, I'm sure I'll have 4 claycarsons instead of 2.

distribution_identity-2.cer

Ah, ok; it showed up under keys, Clay Carson, private. Cert Name: iPhone Distribution, Clay Carson.

Saving as "Clay Carson Distribution Private Key"

Gave xxxxx as the pass

Prompting keychain access to export from my key chain.

Ok - it's *my* keychain, not his, so don't have to worry about using my password.

Ok; so the last sequence was all about creating keys for signing a certificate - an ios distribution certificate.

The next step is to:

Create and download your iOS Distribution Provisioning Profile for App Store Distribution


To successfully build your application with Xcode for distribution via the App Store, you first need to create and download an App Store Distribution Provisioning Profile.


These are different than the Development Provisioning Profiles that were used earlier in that Apple will only accept applications if they are built with an App Store Distribution Provisioning Profile.

Ok, so basically, the build needs that thing to be sent up to the app store.


The Bataan death march lurches onward.

Team Agents should navigate to the Provisioning section of the Provisioning Portal and select the Distribution tab.

// delete the cert4 one

Oops - I deleted the distribution profile.

Select the App Store radio button. // new profile

// add the new profile

Enter the name for your Distribution Provisioning Profile.

// Mye Quiz Application Distribution Profile

Confirm your iOS Distribution Certificate has been created and is displayed.

// yes

Select your wild-card App ID to build all of your applications with your single Distribution Provisioning Profile.

// yes

Click ‘Submit’.

// ok it's pending. Why was the last one invalid? Could I have edited it?
// The good news is that I don't think I had the wild card option before.

Click on the name of the Distribution Provisioning Profile to download the .mobileprovision file.

// Ok, here's the big moment...

Drag the .mobileprovision onto the Xcode or iTunes icon in the dock to install.

Ah...sweeter than sweet. It works this time. No horrible message.

Now, the into unchartered territory:

Building your Application with Xcode for Distribution
Launch Xcode and open your project.


If you have not already done so, drag the Distribution Provisioning Profile downloaded from the Provisioning Portal onto the Xcode or iTunes icon in the dock (or, drag into ‘~/Library/MobileDevice/Provisioning Profiles’ directory.)


Open the Xcode project and Duplicate the “Release” configuration in the Configurations pane of the project's Info panel. Rename this new configuration “Distribution”.

// It wouldn't have hurt to say "right click on the project to bring up the
// menu, then select info panel". That's ok. What's another 15 minutes of my life?


In the Target Info window, select the ‘Build’ tab and set the ‘Configuration’ to ‘Distribution’


In the Target Info window, navigate to the ‘Build’ pane.


Click the ‘Any iOS Device’ pop-up menu below the ‘Code Signing Identity’ field and select the iOS Distribution Certificate/Provisioning Profile pair you wish to sign and install your code with.

// nooooo....there is no Code Signing Identity field...ah, it was a just a
// poor interface.
// There's a gap between the bottom of the list and the bottom of the box, making
// it look as if there were no more entries. Why put a box in a box?


Your iOS Distribution certificate will be in bold with the Provisioning Profile associated with it in grey above. In the example below, ‘iOS Distribution : Example Corp, Inc.’ is the Distribution Certificate and ‘My App Store Distribution Provisioning Profile’ is the .mobileprovision file paired with it.


// Ok. Still alive.


6. In the Properties Pane of the Target Info window, enter the Bundle Identifier portion of your App ID. If you have used an explicit App ID you must enter the Bundle Identifier portion of the App ID in the Identifier field. For example enter com.domainname.applicationname if your App ID is A1B2C3D4E5.com.domainname.applicationname. If you have used a wildcard asterisk character in your App ID, replace the asterisk with whatever string you choose.

// I'm glad I went with the wildcard.

// This must be the plist. I call it Mye Quiz Application.

In the project window, select the Distribution Active Configuration from the overview popup and set the Active SDK to the desired Device.

// ok -
Click ‘Build’. (Note: Your binary must contain a flattened, square-image icon that is 57x57 pixels. This icon is displayed on the iPhone or iPod touch home screen.)

// and don't forget to replace the the new icon!


// Waaah... It built. Wow.

Click ‘Build’. (Note: Your binary must contain a flattened, square-image icon that is 57x57 pixels. This icon is displayed on the iPhone or iPod touch home screen.)

// Compressed.

Verifying a Successful Distribution Build
To confirm your build was successful, check for the following:

Open the Build Log detail view and confirm the presence of the "embedded.mobileprovision” file.


This will take you to the line in the build log that shows the provisioning profile was successfully called.

Ensure that the embedded.mobileproviion is located in the proper “Distribution” build directory and is not located in a “Debug” or “Release” build directory.

Also, confirm that the destination path (at the very end of the build message) is the app you are building.

// Ok. All good. It would have helped if they told you *how* to look at the log.
// I found it by http://stackoverflow.com/questions/1488931/how-do-you-show-xcodes-//build-log-trying-to-verify-if-iphone-distribution-build, clicking a little tiny
// something in the lower right. Screw you apple.


Search for the term “CodeSign” in the Build Log detail view - this will take you to the line in the build log that confirms your application was signed by your
iOS Certificate.

// ok, found something that says code sign.

// More stuff for prosperity:


If your project is lacking any of the above files or pointing to the wrong directory, do the following:

Select the Target and open the Build Settings Inspector. Confirm you are in the Distribution Configuration.
Delete the Code Signing Identity: iOS Distribution : COMPANYNAME
In the Xcode Build Menu, select Clean all Targets.
Delete any existing build directories in your Xcode project using Finder.
Re-launch Xcode and open your Project.
Re-enter the code-signing identity iOS Distribution : COMPANYNAME in the Target Build Settings Inspector.
Rebuild your Project.
Updating your Application
The App Store uses three pieces of information in your application to identify a submission as an update to an existing application. *When you are submitting an update of your application to iTunes Connect for App Store distribution, make sure to:

Use the same Distribution Provisioning Profile to build each new version of your application
Increment the CFBundleVersion and CFBundleShortVersionString values in your project Info.plist file. Note: Version numbers must be period-delimited sequences of positive integers (1.0 to 1.1, or 2.2.1 to 2.2.2).


Ok. Now, I can circle back and recreate all the stuff I did before, then upload the app. It's late. I'll try it tomorrow.

No comments:

Post a Comment