Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "could not be added to your itunes library because it is not a valid app" error when trying to install Ad-Hoc build?

I've recently upgraded my Mac to Lion, and also Xcode 4.

In Build Settings, I've set "Code Signing" for "Release" to be "iPhone Distribution" which matches our Ad-Hoc provisioning file (which we've used in the past, on Snow Leopard/Xcode 3).

I have deleted the old Entitlements file (as it's apparently no longer used by Xcode 4).

In the Scheme section, I've set Archive to use the Release build.

I'm building with Product > Archive.

I'm saving the file by going into the Organiser and clicking Share, then making sure the same Ad-Hoc provisioning is selected.

I'm sending the resulting IPA file to my boss, who has previously installed this app. When he tries to install it, he gets the message "[appname] could not be added to your itunes library because it is not a valid app".

I've been trying every combination of settings I can think, but we just cannot get this to work. I can find this error only twice in Google - once from someone with a jailbroken phone and another posted in comments of an article, someone having the same issue, but there are no responses.

Any help would be really appreciated.

Edit: Same thing happens trying to drag the IPA into iTunes on the Mac that created it! :(

Edit2: Just taken another (almost identical) project and tried a build without "Modernizing" the project, or selected any of the new options in Xcode (icons, launch images, orientation etc.), and this build works. I'm going to work through each of the things I did with the original app with this one, testing at each step. Hopefully should be able to isolate which step is breaking the compiled app!

(also posted to Apple Dev Forums)

like image 357
Danny Tuppeny Avatar asked Sep 27 '11 14:09

Danny Tuppeny


2 Answers

I believe I've tracked this down... It seemed to be happening really intermittently, so it's taken some time (I'd reproduce it, roll back the change, confirm it worked, then re-apply the change, for it to then work again!).

However, after much cleaning/restart/etc., I believe it's related to the "Build" version in the target settings (there are now two version fields, "Version" and "Build"). It seems that if "Build" is blank, then this error occurs.

Unfortunately, changing this value doesn't seem to rebuild properly, so sometimes if you change it, then Archive, you still get the previous value. Manually cleaning before Archiving seems to work around this.

The value gets written into the plist file as CFBundleVersion.

like image 92
Danny Tuppeny Avatar answered Oct 12 '22 21:10

Danny Tuppeny


Recently I suffered a problem with an Ad-Hoc installation using TestFlight service, the message in the log didn't help too much:

Jul 25 12:52:39 MyiPad installd[477] <Error>: 0x10059c000 init_pack_state: Archive we've been requested to install is 0 bytes. That can't be a valid ipa.

After many tests, I found this question and the problem was the same, the Build field was empty (this answer save my day :-) )

So, if anyone else has this problem on TestFlight, I hope my answer allows to find this page easier ;-)

like image 39
Roberto Avatar answered Oct 12 '22 21:10

Roberto