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?

做~自己de王妃 提交于 2020-01-03 07:29:08

问题


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)


回答1:


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.




回答2:


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




回答3:


I also faced the same issue. After doing some research found below answers as:

  • App Version and Build version should not blank.
  • Don't put special characters in my app bundle name.
  • And also there was no issues with my provisioning profiles.

After debugging found that there was name mismatch in my scheme name and info.plist file name. In my project, I have 3 schemes like a,b,c and only one a-info.plist file. I was creating IPA for different scheme like 'b'.

In your scenario, if you have created multiple schemes then check your Info.plist name. That should have to be same as your scheme name (for which you are creating an IPA).

Example. The scheme name is 'myScheme' then your Info.plist file name as 'myScheme-Info.plist'.

Hope this will help you.




回答4:


I got the same message ("not a valid app"). In my case, I was FTPing the built app to a web server then I would be able to OTA provision it. I was not swapping to binary mode before I was putting the file, so the .ipa file got corrupted on the way. Took me most of the evening to figure that stupid mistake out...




回答5:


ok.. do one thing.. Open info.plist.. Go to bundle identifier and change bundle identifier name. It needs to be unique.. something like "com.yourcompany.projectname" and create and try to install the ipa.. It should work




回答6:


I came across this question while researching a similar problem so I'll answer here even though the cases are not identical, because others will search for the same error message.

I had an ad-hoc app that everyone in the development team could install fine, except one person, who got the error from iTunes:

X is not a valid app

He had been able to install earlier versions of this app. Rebuilding the app, changing the version number and changing the build number had no effect, he still could not install but others could.

I fixed it by creating a brand new Xcode project, either copying the files or copying and pasting the content of the files from the old project to the new one, and rebuilding the app and signing it in exactly the same way as the old project. It worked.




回答7:


I had a similar issue while trying to create an .ipa for adHoc distribution for one of the Old project (built a year ago by ex-developer). After a lot of research in google and following the above solutions it didn't worked out for me somereason.

Later after following this link - here. By replacing the .plist file with the existing working projects (obviously - the relevant icons/bundle display name/identifier) and renaming with the current .plist name. It worked for me.

I literally spent about 3-4 hours to fix this issue. Hope it helps some one.

environment was native - iOS app.




回答8:


add...... "Application requires iPhone environment" in your info.plist or if added give it value "YES". Check "Build" and "Version" in general are not empty.... hope this will work




回答9:


Importing the project contents in to a new Project solved the issue for me.




回答10:


For me, we were trying to do an enterprise build of a very old app, from iOS 5.

After confirming profiles and everything else was fine, debug builds work correctly, I noticed the general consensus was around issues with the info.plist file.

I compared the info.plist with another app and sure enough,

Application requires iPhone environment = NO

Basically this key needs to always be set to YES for iOS apps regardless whether its for iPhone, iTouch or iPad...

It may not be limited to that key for everyone but make sure the info.plist looks similar to working apps.

Bundle version
Bundle versions string, short

should always be present!




回答11:


right.. but I guess it is clashing with earlier bundle identifier( this happens because you have upgraded the Xcode). Did you try and change the existing bundle identifier name and install ? I had identical problem and wasted 3-4 days.. I changed existing bundle identifier name and it worked.. Also you may want to check Bundle name and Bundle version are present in info.plist



来源:https://stackoverflow.com/questions/7570644/why-do-i-get-could-not-be-added-to-your-itunes-library-because-it-is-not-a-vali

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!