When upgrading an app - the "invalid binary" error... any suggestions?

While upgrading an existing app, I'm getting the notorious:


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


error.

I've gone through everything step-by-step and did all sorts of forum searches, but I can't seem to find a solution to this.

Some particulars:

1. I do have the distribution certificate in my keychain, and it appears to be associated with my certificate as the agent. The provisioning profile is also visible in the Xcode organizer, with no "yellow warnings" about there not being an identity associated with it or anything like that.

2. When building (and doing all the cleaning of targets etc.) the Code Signing for the target is set to iPhone Distribution: mycompany name, which is properly selectable from the popup menu.

3. The build succeeds and I check the build results and CodeSigning is in there, as well as the embedded provisioning profile and the app name is correct.

4. Examining the created package contents, Code Signing is in there as well, and also the embedded provisioning profile.

5. The app ID I used for the distribution provisioning profile is the same app ID I used for the original app. However I did create a new distribution provisioning profile because certs had expired and I changed the name of the distribution provisioning profile. But the distribution cert is now up-to-date and the app ID is the same as it always was.

6. It's not anything like an invalid Icon.png or anything like that, because that didn't change from the original version. This is just an update.

7. The developer provisioning profile works fine and I can load and run the app on my iPhone.

If anybody has any ideas I would be grateful. I've been in code signing h*ll for two days now.

Thanks,

doug

MBP C2D 17", Mac OS X (10.5), 3.0 GB RAM

Posted on Mar 13, 2009 8:30 PM

Reply
18 replies

Mar 13, 2009 10:13 PM in response to Doug Lerner2

Some updates:

1. I checked the first two pages of google links I found, but I've already tried everything in all those posts.

2. I have the latest v2.4 iphone developer programmers guide, and went through every part there, but everything seems according to what I'm doing.

3. I created a second distribution profile with a new wildcard app ID and changed the bundle identifier according to recommendations in the forums and in the programmers guide.

4. I checked the codesign via the Terminal "codesign -vvvv" command and it reports that everything is valid.

But no matter what I try, when I upload again, I still get the same error.

doug

Mar 13, 2009 11:30 PM in response to Doug Lerner2

This is a long shot, but just in case.. I think I got the invalid binary error when I tried to upload a package from a project with an embedded space in the project name. So when I compressed the target package, even the zip had a space in the file name. I thrashed around for half the night until I thought to get the space out of the zip name and that fixed the problem.

Even if you don't have an embedded space char, the point is that "binary" can refer to the zip file itself rather than its contents.

Mar 14, 2009 12:01 AM in response to RayNewbie

Thanks for the post. But the product/package/etc are all one word, no non-alphabetic characters at all.

This is just an upgrade for an existing app.

I think it is a problem with the SDK, like the problem I was having yesterday and needed to repair manually inside the project package. The app was originally created with the SDK in use back in September, and now I'm trying to upgrade it with the most recent SDK and... something... is just not working right.

It took me all day yesterday to find the solution needed to fix the SDK bug so that I could load the app on my iPhone. I wonder if something similar is happening now with the build for the app store.

doug

Mar 14, 2009 12:22 AM in response to Doug Lerner2

In nosing around, and recalling the SDK 2.2 bug I needed to repair yesterday before I could build for my iPhone, I was looking inside the .xcodeproj bundle at the project.pbxproj file.

I notice there are two "Distribution" sections inside:


84D2ED8E0E7F657A00CAA465 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYSSEARCH_USERPATHS = NO;
ARCHS = "$(ARCHSSTANDARD_32BIT)";
CODESIGNIDENTITY = "iPhone Distribution: My Company Name";
GCCC_LANGUAGESTANDARD = c99;
GCCWARN_ABOUT_RETURNTYPE = YES;
GCCWARN_UNUSEDVARIABLE = YES;
PREBINDING = NO;
PROVISIONING_PROFILE = "FF71349B-E962-432A-B05C-8D891F734A7B";
SDKROOT = iphoneos2.0;
};
name = Distribution;
};
84D2ED8F0E7F657A00CAA465 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODESIGNIDENTITY = "iPhone Distribution: My Company Name";
COPYPHASESTRIP = YES;
GCCPRECOMPILE_PREFIXHEADER = YES;
GCCPREFIXHEADER = HelloWorld_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = MyAppName;
PROVISIONING_PROFILE = "FF71349B-E962-432A-B05C-8D891F734A7B";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "B260C653-9A45-432C-A472-31F1531EEA44";
};
name = Distribution;
};


Is that normal? Could the fact there are two sections be what is causing the problem?

The provisioning profile ID that starts with "B" is the developer's profile, and that's what lets me build so I can test on my iPhone. The provisioning profile ID that starts with "F" is the distribution provisioning profile.


doug

Mar 14, 2009 12:33 AM in response to Doug Lerner2

Or perhaps it's a problem with this section in the Program Users Guide:


1. Use the same Distribution Provisioning Profile to build each new version of your application
2. 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).


With regards to (1), the original Distribution Provisioning Profile no longer exists. After personal certs expired this week, I needed to create a new one. The new distribution provisioning profile does use the same App ID though.

Could that be what is causing the binary to be invalid for upload?

If so... what can I possibly do about it? This is sort of a "you can't go home again" situation.

With regards to (2), my project has never had a "Bundle Short Version String". I see how you can add extra items to the plist with the "+" UI. Do I need to add a short bundle string into the plist? I never have before.

Thanks,

doug

Mar 14, 2009 6:55 AM in response to Doug Lerner2

Just some more diagnostic information to keep it all in one place, in case some kind soul has any suggestions.

Checking the app in the Terminal with the codesign -dvvvv command, the result is as follows:


Executable=/Users/admin/Desktop/unfuddle/mycompany_myapp/build/Distribution-iphoneos/MyAppName.app/MyAppName
Identifier=com.mycompany.MyAppName
Format=bundle with Mach-O thin (armv6)
CodeDirectory v=20001 size=417 flags=0x0(none) hashes=12+5 location=embedded
CDHash=2fe8af602eadfc566cba181273acc0c7591387cd
Signature size=4331
Authority=iPhone Distribution: My Company Name, Ltd.
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=Mar 14, 2009 7:16:30 PM
Info.plist entries=17
Sealed Resources rules=3 files=16
Internal requirements count=0 size=12


I don't see any obvious problems being reported.

In another thread, somebody said they were able to upload with FireFox even though they couldn't with Safari, so I tried that as well, with no success.

doug

Mar 15, 2009 11:03 PM in response to Doug Lerner2

Hi, i had the same problem when uploading the last update. I've no idea what had caused the probblem, but the only thing i did was to close the finder-window which was showing the target-folder of the app-bundle.
After that i did a clean und build.
Then i opened the finder again by right-clicking on the app-entry in the navigation-pane in xcode and select "reveal in finder"
Then i compressed the bundle and the upload went fine.

Mar 16, 2009 5:05 AM in response to Doug Lerner2

I still haven't been able to get my upgraded app's binary uploaded. I'm worried now that I won't ever be able to upgrade any of my apps again. I can't think of a place to turn to anymore for information.

I have complete details, including screenshots, that I sent to Apple (still no reply). if there are any interested and/or kind-hearted souls out there I would be happy to share the details I sent Apple. I'm open to any suggestions at all!

Thanks,

doug
doug@lerner.net

Mar 16, 2009 6:09 AM in response to Doug Lerner2

I can't believe it, but after multiple-days of Code-Signing h*ll I fixed it! The app is now uploaded and 'in review".

For those interested in my solution, here is what I did.

I opened up the .xcodeproj package for a previous app we have in the app store (let's call it OtherApp) and then opened up project.pbxproj in BBEdit and looked at the sections for "Distribution" and they looked like this:


8418EBF90E90792200A3FDDA /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHSSTANDARD_32BIT)";
GCCC_LANGUAGESTANDARD = c99;
GCCWARN_ABOUT_RETURNTYPE = YES;
GCCWARN_UNUSEDVARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos2.0;
};
name = Distribution;
};
8418EBFA0E90792200A3FDDA /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYSSEARCH_USERPATHS = NO;
CODESIGNIDENTITY = "iPhone Distribution: My Company Name, Ltd.";
COPYPHASESTRIP = YES;
GCCPRECOMPILE_PREFIXHEADER = YES;
GCCPREFIXHEADER = OtherApp_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = OtherApp;
PROVISIONING_PROFILE = "E6A3BCFE-372D-4623-AB15-44158ADA0E1B";
};
name = Distribution;
};


But in the project.pbxproj file for the app I was trying to upgrade (let's call it ThisApp) those sections looked like this:


84D2ED8E0E5B857A00CAA465 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYSSEARCH_USERPATHS = NO;
ARCHS = "$(ARCHSSTANDARD_32BIT)";
GCCC_LANGUAGESTANDARD = c99;
GCCWARN_ABOUT_RETURNTYPE = YES;
GCCWARN_UNUSEDVARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos2.0;
};
name = Distribution;
};
84D2ED8F0E5B857A00CAA465 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODESIGNIDENTITY = "iPhone Distribution: My Company Name Ltd.";
COPYPHASESTRIP = YES;
GCCPRECOMPILE_PREFIXHEADER = YES;
GCCPREFIXHEADER = ThisApp_Prefix.pch;
INFOPLIST_FILE = Info.plist;
PRODUCT_NAME = ThisApp;
PROVISIONING_PROFILE = "00D072E0-3459-4AFF-911E-B31D325E7375";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "B260C653-9A45-372C-A472-31F1531EEA44";
};
name = Distribution;
};


So (after backing up the current version) I:

(1) deleted the 2nd "PROVISIONING_PROFILE" line (which is the developer provisioning profile - so I don't know what will happen now if I try to load it on my iPhone);

(2) cleaned targets;

(3) built again and the new compressed version uploaded!

Side-note not directly related to the above problem, but of technical interest:

I got another error at the next itunesconnect page saying that the "bundle identifier needed to be the same as the previous version". That was easy to fix though. I went back into Xcode and changed the bundle identifier from com.myactualcompanyname.${PRODUCT_NAME:identifier} back to com.yourcompany.${PRODUCT_NAME:identifier} (the original default value) which was the way we accidentally left it when we first built it in September. (It was our first app, so that snuck by us.) So apparently you can never adjust that once you upload an original app and have forgotten to change "yourcompany" for your actual company name. That's not so important though, and wasn't what was blocking being able to upload the app.

Anyway, it now uploaded successfully and is "in review"!

Clearly "something happened" to the project.pbxproj file between the time the app was first created in September and when the SDK was updated after that.

But it's in review now!

doug@sigh of relief

Apr 20, 2009 4:54 AM in response to RayNewbie

Thank You!
We previously uploaded a Lite version with a space in the binary. All we had to do was remove the space from the zip file. The Web Loader will not however accept this, so thinking along the same lines I simply removed the space from the binary. Tried uploading this for the past Three days trying every trick in the book to find the issue. I just tried uploading the application with the App Loader, and it's currently in-review.

I now have quite a few bruises on my forehead....

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

When upgrading an app - the "invalid binary" error... any suggestions?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.