Monday, October 10, 2011

XCode 4 Submitting an app to the app store notes

Ok, we've been through the painful process of submitting an app to the app store before. The time has come to do it - again. The last time was actually more difficult, because we were submitting the up under a client's name. This time, it's under our own company's name, so hopefully, that will at least slightly simplify the process.

Ok, so what I id last time was log in to the developer portal with my company email address, which brings us here:

https://developer.apple.com/devcenter/ios/index.action

Then, go to the iOS provisioning portal.

Welcome to the iOS Provisioning Portal

The iOS Provisioning Portal is designed to take you through the necessary steps to test your applications on iOS devices and prepare them for distribution.


If I look under the "Provisioning" link, I have a Provisioning profile called JlptVocabQuizProfile.

Ok, looking at my previous post on getting my app on to the ipod, I see I created an app id called this:

JlptVocabQuiz

Ok, let's just walk through the process. That usually seems to do the trick.

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


Ok, I think I can start here:

Building your Application with Xcode for Distribution

Launch Xcode and open your project.
- done

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.)


Ok, I'm having trouble following the next entry about duplicating the release. So, let's try this:


http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/DistApps/DistApps.htm

Distributing Applications

Before submitting an application to the App Store or share it with others, you create an application archive.

You can then share your application archive with application testers and other application developers or distribute it to users.

To have the application considered for inclusion on the App store, you submit the archive to iTunes Connect.

To ensure your application archive passes essential iTunes Connect validation tests, you can have Xcode validate it before you submit it.

// let's do that.



Archive Your Application

Before archiving your application, ensure that the binary is self contained.

That is, if it relies on static libraries, ensure that those libraries are part of the application binary by

setting the Skip Install build setting to Yes in the Release build configuration of the target that builds and archives the application.

// That last sentence is a mouthful.



Ok, if I click the highest level node of the project, then click on the target in the main window, and then click on build settings in the tab bar across the top, I think I can see what they're getting at.

Ah, SO to the rescue:

http://stackoverflow.com/questions/5280914/archive-does-not-appear-in-xcode4-organizer


For the "Release" configuration do the following:

Set "Skip Install" to YES on your project

Set "Skip Install" to NO on your application target

Set "Skip Install" to YES on all static library targets that are included

Choose Product -> Archive from the menu.

This worked for me, and is based on advice from the Apple Dev Forums.





Ok, after clearing up a problem with the prefix header - highlight the project, target, build settings, and find "Prefix Header", and give the release version the right name, it created the archive. Yay!

But when I try to validate it, it says "no suitable application records were found", and "Please make sure you have set up a a record for this application on iTunes connect.

So, I've skipped some type of step here.

Ok, from this url:


http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/ios_development_workflow/145-Distributing_Applications/distributing_applications.html

Ensure that an application record for the application exists in iTunes Connect. The information in this record must match the application you want to validate or submit for publication.

These are the main matching criteria:

Application Name

Bundle ID

Version


I think I just need to get back to the iOS developer portal and walk through the whole thing, start to finish.

Well, how about this:

https://developer.apple.com/appstore/

Ok, this looks like a pretty good link:

https://developer.apple.com/appstore/resources/submission/

"Prepare App for Submission".

Ok. Now we're talking.

Get started with iTunes Connect

iTunes Connect is a suite of web-based tools that allows you to submit and manage your applications for distribution on the App Store.

// Everything's named after iTunes. Annoying.

In iTunes Connect you will be able to check the

status of your contracts,

set up your tax and banking information,

obtain sales and finance reports,

request promotional codes,

manage

users,

applications,

metadata, and your

In-App Purchase catalog.


Ok. wonderful.

Set up user accounts

When creating and editing an iTunes Connect user account,

you are able to define user roles and notifications.

Defining notifications determine the type of emails your users will receive regarding your iTunes Connect account.

There are five distinct user roles Admin, Technical, Finance, Sales and Legal. Log in to iTunes Connect


Next:


Gather information and assets for your application

In addition to your binary, you will need to submit or assign several attributes for your app, including:

Application Name
Application Description
Primary and Secondary Category
Subcategories
Copyright
App Rating
Keywords
SKU Number
Application URL
Screen shots
Support URL
Support Email Address
End User License Agreement
Pricing, Available Date, Territories
Large App Icon 512 x 512


App Name: JLPT Vocabulary Quiz App

Application Description:

I'll copy it from the Android

Primary and Secondary Category: Education, then?

Subcategory: I dont think it applies

Copyright

2011 KanjiSoft Systems

App Rating

all

Keywords

JLPT, Vocabulary, Quiz, Practice, Game, Frequency of Use

SKU Number

I think that's a fill in

Application URL

Errr.. ?

Screen shots

I can make those

Support URL

www.kanjisoft.com

Support Email Address

support@kanjisoft.com

End User License Agreement

skip

Pricing, Available Date, Territories
$3.99

Large App Icon 512 x 512

I can make one

Ok, here we go. A 12-year old kid made a video on youtube - say you have to make a distribution provisioning profile.

http://www.youtube.com/watch?v=OtlH4wGbWp0&feature=related

So, go here on the ios developer's portal: (iOS Provisioning Portal, provisioning, distribution)

http://developer.apple.com/ios/manage/provisioningprofiles/viewDistributionProfiles.action


And sure enough, I don't have any of those profiles.

Ok, I'm going to create one. click new, then give it a name:

JLPTVocabQuizDistributionProfile

And select the App Id JLPTVocabQuiz, so that's already been created, when I created the provisioning profile.

Ok, great. It's pending.

JLPTVocabQuizDistributionProfi... 98X643NLB6.* Pending

Ok, now let's download it to a folder on the desktop, JLPTUpload.

Ok, also download the provisioning certificate, called developer_identity.cer

Ok, let's go back to this:

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

As I said here:

http://gettingintomobile.blogspot.com/2011/06/bataan-death-march-resumed-submitting.html


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



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.


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.

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, I think this is basically what I just did.

I guess the name of the .cer file is "distributionidentity.cer". I I had to click the wwdr link download whatever.




Downloading and Installing iOS Distribution Certificates
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.

// did this

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


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.



Ok, it looks like I have one certified private key, somehow through this whole process.

I have several other public and private keys, but I have one good solid, certified private key under my company name.

Next.



Saving your Private Key and Transferring to Other Systems

It is critical that you save your private key somewhere safe in the event that you need to build your application on multiple Macs or decide to reinstall your system OS.

Without your private key, you cannot sign binaries in Xcode and there you will be unable to upload your application to the App Store or install your application on any Apple device.

When a CSR is generated, the Keychain Access application creates a private key on your login keychain.

This private key is tied to your user account and cannot be reproduced if lost due to an OS reinstall.

If you plan to do development and testing on multiple systems, you will need to import your private key onto all of the systems you’ll be doing work on.





To export your private key and certificate for safe-keeping, open up the Keychain Access Application and select the “Keys” category.

Highlight the private key associated with your iOS Distribution Certificate and select “Export Items” from the ‘File’ menu. Save your
key in the Personal Information Exchange (.p12) file format.

You will be prompted to create a password which will be used when you attempt to import this key on another computer.
You can now transfer this .p12 file between systems. Double-click on the .p12 to install on a system. You will be prompted for the password you first entered above.



Ok, next is:

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.


Team Agents should navigate to the Provisioning section of the Provisioning Portal and select the Distribution tab.
Select the App Store radio button.
Enter the name for your Distribution Provisioning Profile.
Confirm your iOS Distribution Certificate has been created and is displayed.
Select your wild-card App ID to build all of your applications with your single Distribution Provisioning Profile.
Click ‘Submit’.
Click on the name of the Distribution Provisioning Profile to download the .mobileprovision file.
Drag the .mobileprovision onto the Xcode or iTunes icon in the dock to install.


Ok, that's done.

It was called: JLPTVocabQuizDistributionProfile.mobileprovision

Ok, this next step:

Creating and Downloading a Distribution Provisioning Profile for Ad Hoc Distribution


Ok, I don't need this. I'm not doing ad-hoc.

Next:

Building your Application with Xcode for Distribution

1. Launch Xcode and open your project.
2. 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.)

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


Here we go again. With Xcode 4, there is no "Duplicate" button.

Is this where I just build the archive?

======= update ================

I missed this earlier - go to iTunesConnect portal, and select "manage your apps"

Then select "Add an app"

My app name is:

JLPT Vocabulary Quiz

Bundle Id is selectable, this one is JLPT Vocab quiz (why is there not an "all apps" selection)

My bundle id suffix is com.kanjisoft.jlptvocabquiz - and I changed it in the info.plist, too.

For sku, i put SKU001

Ok, the path is laid out here:

iTunesConnect_DeveloperGuide.pdf

What it comes down to is, log into itunes connect, add your app, and then drill down a couple of times beneath your icon display (to get to "version details) until you come to a button on the upper right that says "Ready to upload".

That will put you into a status of "waiting for upload".

That still doesn't cover submitting the binary. I'm looking for the apple docs on that, but having a tough time.

This url:

http://stackoverflow.com/questions/5412004/how-do-i-submit-an-app-through-xcode-4s-organizer-im-getting-an-error

talks about issues with submitting an app in xcode4.

Ok, let's try this one again:


http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/DistApps/DistApps.html

Distributing Applications

Before submitting an application to the App Store or share it with others, you create an application archive.

You can then share your application archive with application testers and other application developers or distribute it to users.

To have the application considered for inclusion on the App store, you submit the archive to iTunes Connect.

To ensure your application archive passes essential iTunes Connect validation tests, you can have Xcode validate it before you submit it.


Ok, so it's clear that it's the application archive, e.g. zip file, that is submitted.


Archive Your Application

Before archiving your application, ensure that the binary is self contained.

That is, if it relies on static libraries, ensure that those libraries are part of the application binary by setting the Skip Install build setting to Yes in the Release build configuration of the target that builds and archives the application.



How do I know it it relies on static libraries? I have a flurry library, which is .a.

It is a static library. I found a good link here:

http://stackoverflow.com/questions/5295890/iphone-ad-hoc-build-using-xcode-4

I'm just going to set the skip-install to "yes" for now, on the release, build settings.

But I'll get back to that later. For now, continue with the apple doc.


Archive your product for submission to iTunes Connect or for sharing with others.

Schemes
// What is a scheme in this case? It looks like, run on device, simulator for iPad, iPod, etc.

have an Archive action

with settings you use to customize the archive that Xcode creates when you choose Product > Archive.


To archive your application . . .
From the Scheme pop-up menu, choose a scheme.
From the same menu, choose Edit Active Scheme to display the scheme dialog.
In the left column, select Archive.
Choose a build configuration. // should I have a new one for this?

Specify a name for the archive and click OK.

Choose Product > Archive.

O.k. Trying the Product > archive.

It built the archive, and I tried to upload it to the appstore from organizer.

But I got the error the bundle id didn't match. I had guessed at jlptvocablquiz, but rats, it was JLPTQuizApp. So, I'm changing it in plist.

But when I ran the product, archive, I this nasty-gram:

Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011)


After much panicky googling, I tried the experiment of changing the code-sign to the deployment certificate / profile instead of the development certificate on the release for build settings. That got rid of the error.

But the next problem was that, even though the build succeeded, it wasn't appearing in organizer.

So, I'm trying this, from SO:

This is based on another answer from a similar question which can be found at Archive does not appear in xcode4 organizer

I take no credit for this answer, but this together with the suggestions from Ron fixed the problem for me.

For the "Release" configuration do the following:

Set "Skip Install" to YES on your project

Set "Skip Install" to NO on your application target

Set "Skip Install" to YES on all static library targets that are included

Choose Product -> Archive from the menu.


Well, ok, I did the first two, but I don't see any static target.

I'll try to submit without it, but I don't know if it will work. Pfft.

Next it gives me a problem with UIBackroundModes being null. Well, I'm not doing anything like playing audio, so, I don't need that variable, so I'm just deleting it.

Try again.

Ok, well, it's taking a lot longer to upload, at least.

Maybe too long...how big is it, anyway?

At last - "submission succeeded". Hooray!

No comments:

Post a Comment