views:

19543

answers:

19

I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect:

The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.

My guess is that it is not properly signed. I have downloaded my App Store distribution certficate, but I can't figure out how to "sign" my application with it. The SDK's documentation about code signing is not very helpful. (FWIW, I can install the app on my iPhone just fine using the development provisioning profile.)

However, it is possible that I screwed things up on a more basic level. Here's what I did to try to prepare it for upload:

  1. In Xcode, select the Device|Release target
  2. Select the target and click the Info button. Change "Code Signing Identity" to "iPhone Distribution", and change "Code Signing Provisioning Profile" to my App Store distribution profile.
  3. Build
  4. Go to the directory where the built MyApp.app bundle is, control-click and choose "Compress" to create MyApp.zip
  5. Upload MyApp.zip to the App Store via iTunes Connect (which resulted in the above error message).

Can anybody give me any hints?

Edit: Found someone with the same problem. Unfortunately, he won't tell us how he fixed it.

(Note: For general information on submitting iPhone applications to the App Store, see Steps to upload an iPhone application to the AppStore.)

+1  A: 

Well, after repeating the steps several times, I was finally successful in uploading my app.

I don't know exactly what fixed it, but prior to the successful attempt, I closed Xcode and Firefox and restarted them. I guess one of those apps had some bad juju.

Kristopher Johnson
+14  A: 

It's been my experience that XCode occasionally gets confused about which signing certificate to use. I got into the habit of quitting and restarting XCode after any change to the code signing settings (and doing a clean build) to work around this problem.

Mark Bessey
That worked for me... :)
ing0
A: 

hi to All,

Hope you all are fine and in yours' best of moods today.

I want to know that have you find solution of your problem that you have written above?

I want to know the basic steps for uploading my iPhone application to AppStore.

I even don't know how to made provisioning profile using certificate also not knowing other settings i need to do to upload an application.

I have just made an application on my iMac using xcode-sdk v_2.2.1, now what i need to do for uploading it on apple store ..

I am member of that and I have distribution certificate also.

Sorry for my wrong English.

Arun Thakkar
See http://stackoverflow.com/questions/796482/steps-to-upload-an-iphone-application-to-the-appstore
Kristopher Johnson
Good luck. The process is rather nightmarish. It took me a few tries and it was agonizing.
Nosredna
+3  A: 

I had the same issue and solved it this way:

The property certificates were installed on my development machine and mobileprovision.embedded was included in the distribution archive. After an hour or so of Googling and digging I found the source the error. Inside Xcode I had copied the Release configuration and created a new Distribution configuration and then changed the signing identity to my distribution certificate. However, even though it was updated in the GUI the project file was not updated correctly.

If you come across the same error, look in your [ProjectName].xcodeproj directory for the project.pbxproj file and open it in your favorite editor. Look for the Distribution section. My broken one looked like this:

C384C90C0F9939FA00E76E41 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_ENTITLEMENTS = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]” = “iPhone Distribution: Edward McCreary”;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
“PROVISIONING_PROFILE[sdk=iphoneos*]” = “F00D3778-32B2-4550-9FCE-1A4090344400″;
SDKROOT = iphoneos2.2.1;
};
name = Distribution;
};
C384C90D0F9939FA00E76E41 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = “iPhone Developer: Edward McCreary”;
“CODE_SIGN_IDENTITY[sdk=iphoneos*]” = “iPhone Developer: Edward McCreary”;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = GenPass_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = GenPass;
PROVISIONING_PROFILE = “DB12BCA7-FE72-42CA-9C2B-612F76619788″;
“PROVISIONING_PROFILE[sdk=iphoneos*]” = “DB12BCA7-FE72-42CA-9C2B-612F76619788″;
};
name = Distribution;
};

You can see the signing identity and provisioning profile are incorrect in the second section. Edit it to match the first section, rebuild, and you should be good to go. The final one looked like this:

C384C90C0F9939FA00E76E41 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CODE_SIGN_ENTITLEMENTS = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]” = “iPhone Distribution: Edward McCreary”;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
“PROVISIONING_PROFILE[sdk=iphoneos*]” = “F00D3778-32B2-4550-9FCE-1A4090344400″;
SDKROOT = iphoneos2.2.1;
};
name = Distribution;
};
C384C90D0F9939FA00E76E41 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = “iPhone Distribution: Edward McCreary”;
“CODE_SIGN_IDENTITY[sdk=iphoneos*]” = “iPhone Distribution: Edward McCreary”;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = GenPass_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = GenPass;
PROVISIONING_PROFILE = “F00D3778-32B2-4550-9FCE-1A4090344400″;
“PROVISIONING_PROFILE[sdk=iphoneos*]” = “F00D3778-32B2-4550-9FCE-1A4090344400″;
};
name = Distribution;
};

guids changed to protect the innocent

Eddie
+1  A: 

Here's an issue I ran into: I added the binary to Subversion before uploading. Comparessing/zipping the binary then included the hidden .svn directories, which messed up the code signing.

Aaron
+3  A: 

Same problem, different solution.

In my case, I was compressing the file using zip -r myapp.zip myapp.app Turns out, the zip command screwed the bundle. Compressing it from the finder made it work.

Jorge Bernal
Exact same thing happened to me about a month ago. Infuriating.
jbrennan
Just had this same solution work. I tried @shirikodama's solution below and it didn't work - have you found a way to compress in the command line?
Jesse Beder
Never mind, I was doing a `cp -r` and *then* the zip, and it was the `cp` that screwed up the sym links in the app. It should be `cp -R` to preserve sym links.
Jesse Beder
+10  A: 

I just wanted to mention that I too had the problem with zip from the command line as well. The problem lies in the way it handles symlinks by default. Using:

zip -y -r myapp.zip myapp.app

Solved that problem.

shirikodama
excellent catch. fixed my problem. thank you.
scootklein
+1  A: 

I tried various things after reading various posts including those above. What finally worked for me was starting completely over! I deleted every certificate and provisioning profile associated with my app.

I recreated a new development certificate and a new distribution certificate. I downloaded the intermediate certificate again. Then I recreated both the development profile and the distribution profile.

After installing the three certificates (I noticed the distribution had both private and public keys this time) and the two provisioning profiles (my distribution profile didn't get flagged as not having a valid certificate!), everything worked.

Once I made the decision to revoke everything and just start over, it only took about 5 minutes to create the new stuff and re-install.

Troy Sartain
+1  A: 

I had the same problem aswell, when building I noticed the provisioning wasn't added in the build.

The fix for me was to set the build to the iphone device as where I normally use the simulator, but then it won't include the provisioning profile...

This might be a noob mistake, but normally you can't build to device, but when you do it for distrobution you can.

Eric
+3  A: 

I had the same issue and after trying several things - I removed the .plist entitlements from the Code Signing Entitlements (just left it blank) and it built fine and uploaded FINALLY.

Good luck all :-D

Signal2
I cannot believe this fixed it. It's especially ridiculous since they're so explicit about the entitlements file in the Provisioning Portal documentation.
alord1689
this got me as well, removing it fixed the problem. thanks for the tip.
beno
A: 

Hi, new to Stack Overflow (be gentle with me!), but have found it very useful so far, so thought I would contribute to help alleviate the nightmare that is code-signing:

Just had this problem today - the answers here didn't help. But finally found out the problem:

Make sure using pull down menu: Project>Edit Active Target "ProjectName" to change Code Signing to Distribution - I was selecting the Project in the Groups & Files pane and using the Info button which shows the PROJECT info rather than the TARGET info - very confusing! Only realized when I turned code signing off in the project and built and it still wanting to code sign!

I think this is why in Eddie's post he had to change it at the project.pbxproj level

Also on original post in 1st step: 1. In Xcode, select the Device|Release target Surely it should be Device|Distrubution target? (assuming this copied release and renamed it Distribution as per Apples instructions in the Provisioning Portal)

Hope this helps!

ayreguitar
A: 

Ayreguitar's recommendations "Make sure using pull down menu: Project>Edit Active Target..." worked for me. Thanks a lot!

I suspect Eddie's suggestions to edit project files will produce the same results

mkvakin
A: 

Thanks Guys! This helped me a lot :-)

Crazy Developer
A: 

My two cents:

Download the latest version of the Application Loader. I've just updated and now get a different error message.

Ross
A: 

I had the same problem. I was ready to throw in the towel on this problem but I figured it out when I went to check in my code using Murky. I always skim the diffs on the files that changed before I check in. When doing so this time I noticed that the project.pbxproj file had changed....and in the Distribution section the entry for “PROVISIONING_PROFILE[sdk=iphoneos*]” was blank.

Quiting and restarting didn't work for me. Instead, I went into both my project and target settings and changed the code signing to directly select my Distribution profile rather than relying on the auto-select feature. Doing this caused the project.pbxproj file to populate with the correct values even though the auto-select feature supposedly selected the exact same profile that I selected manually.

I need a beer...

NorthStar7
A: 

I was having a similar problem, but I don't use entitlements.plist. However, after a dozen failed uploads, I checked my info.plist and discovered something. My CFBundleIconFiles array had an empty entry. I removed that and re-submitted, and it was finally accepted!

Seriously, how hard would it be for Apple to expose those kind of validation errors?

Greg Haygood
A: 

See this link for the solution:

http://greghaygood.com/2010/09/04/invalid-binary-message-from-itunesconnect

The short answer is that "Eventually I double-checked my info.plist and discovered something. I added CFBundleIconFiles per the new guidelines, but there was an empty entry in the array list. I removed that and re-submitted, and it was finally accepted!"

simon
A: 

I just went through this hassle (again) but this time I found that my distribution profile had a status of "Invalid". If you think everything else is right, double-check the status in the portal and renew/re-download anything that isn't in the Active state.

woodmantech
A: 

For me it was the same fix as Eric's, I must have missed this in the Apple docs.

"The fix was to set the build to the iphone device, I normally use the simulator..."

Thanks to everyone, I've been battling with this for 2 days.