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? - iphone

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)

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.

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

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.

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

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

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.

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.

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

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

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!

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

Related

Can't Upload .ipa from Xcode 8, "The info.plist indicates a iOS app, but submitting a pkg or mpkg."

I am trying to submit my app. It is written in swift 3 and has an iOS 10 deployment target. So, I need to use Xcode 8. When I create an archive everything goes fine. I have even looked into the .ipa and everything seems fine.
But, every time I get this error:
The info.plist indicates a iOS app, but submitting a pkg or mpkg.
No idea what's going on. I'm not using any frameworks. No cocoapods. Very simple app.
Edit: Still no information on this. I have made a support request with Apple so we will see if that provides any new info. I can't be the only person experiencing this bug.
Update: See Peter's answer. According to him, the LSMinimumSystemVersion key ("Minimum system version") is obsolete and should be removed. If that works for you, upvote his answer instead as that would be a better solution than this if it works.
Original Answer:
I was encountering this issue when updating a very old app. I was able to fix it by changing my Info.plist.
I had to change the LSMinimumSystemVersion key ("Minimum system version") to MinimumOSVersion ("MinimumOSVersion").
Before
After
In Xcode 8.3, you should delete the Minimum system version (LSMinimumSystemVersion) entry from your info.plist. You do not need to rename it. If your app is that old, you may find other superfluous or conflicting keys as well. Another common one is the main nib file key, which conflicts with a main storyboard key.
fix!
i had the same problem and i fix it.
you can export your app (no click on "upload to app store" but "export" in the archive menu) and then use "application loader" to send your app
even if you never imported any frameworks, something might be produced automatically.
So please make sure your project has never any frameworks in it.
If you are not sure, when you export your archive file to .ipa, Xcode will code sign your bundle.
In that list, if you see any framework besides your main app bundle, it occurs.
So let me know the status of your project in the aspect I mentioned above.
Thanks

XCode error "The application bundle does not contain a valid identifier."

Recently, after upgrading to Lion and Xcode 4.2.1 I am getting this error when trying to run my app on my iPhone 4S:
"The application bundle does not contain a valid identifier."
My identifier is indeed valid, and I have been able to run my app with this identifier earlier.
The problem might appear when I change computers.
I have two computers that I am using to code my app, and I am using Dropbox to keep track of my files.
Restarting XCode, my mac and my iPhone does not work.
Cleaning the target and rebuilding does not work.
The only thing I have been able to do to fix it is to create a completely new project and moving my files. This made things work until I swapped computer. Now I am in the same trouble again.
Any idea? Anyone?
Three suggestions:
Check that your developer key is in both computers
Did you try to update the project? There is a strangly-named key in the middle bottom under the project's properties. Try this.
I had similar issues. I found that some things weren't updated when I updated osx and xcode. To get out of the situation, I would suggest creating a new project and copy paste code, files and build settings. This might seem stupid, but you know apple is not good at creating IDE's. You might just get your self lost in the undocumented settings.

Argument invalid with every build in Xcode?

No matter what I try, I get an Argument is Invalid error in Xcode when I try to build to my iPhone. It works fine in the simulator. The problem is not specific to one project, it happens with any project, even when I create a new one. When I run the console it displays this
I tried deleting and re-adding the provisioning profiles, and I've gone through every setting to look for spaces because I heard these can cause this error. Can anyone help? I don't know what else to try.
If you have a symbolic link (ln -s) in your project directory, it will work on the simulator, but cause a “The argument is invalid” error if the target is a real iOS device. (Xcode 4.5.2)
You may check if you have a space somewhere in the settings, such as the product name or so. These cause these kind of errors in many cases....
Also sometimes a symlink in your bundle can be the reason - depending on how you set up your file structures in the app bundle...
Actually this looks like and xcode error because it cant find those .m files. So here is a post that responded to hopefully it helps. It looks like you are gonna have to do some installation and reinstallation. XCode Update - iOS Link Error
I am assuming you are working with Git. This often happens due to issues in your local build. Take the latest pull from the develop branch and check if this solves your issue. If this doesn't work, you might want to manually check the build settings for your app.

IPhone Development Profile Expired

I really combed this site and others. I read and re-read the related links here and the Apple docs. I'm sorry, but either I am obviously missing something right under my nose, or this Apple profile/certificate stuff is a bit convoluted. Here it is:
I have a product in the App Store.
I have updated it several times and users like it.
My development profile recently expired just when I was improving the app for its next release.
I can run the app in the simulator.
I can compile and put the distribution build on my iPhone just fine.
I went to the Apple portal and renewed the development profile.
I downloaded it and installed it in Xcode.
I see it in the Organize window.
I see it on my iPhone.
I CANNOT put the debug build on my iPhone to debug or run with Instruments. The message is that either there is not a valid signed profile or it is untrusted.
I subsequently tried to download and install the certificate to my Mac's keychain.
Still no success.
I checked the code signing section of Project settings and also for the target and the root. All appears to indicate that it is using the expected development profile for debug.
Yes, I had deleted the old profile from my iPhone, from the Organizer. I cleaned the Xcode cache and all targets. I have done all of this several times and in varying sequences to try to cover every possibility.
I am ready to do anything to be able to debug with Instruments in order to check for leaks or high memory usage. Even though the distribution compile runs fine on my iPhone and plays well with other running processes, I will not release anything without a leaks/memory test.
Any ideas will be appreciated. If I missed something obvious, please forgive me - it was not due to just posting a question without searching for similar postings.
Thanks!
All problems solved! I am very happy this all happened because I learned so much about Xcode, keychains, certs and provisioning. Unfortunately, there is not a simple answer. Here are the highlights:
I needed to recreate the ad-hoc profile and install it on my device. (That was MY BIG oversight and the reason the dist build no longer ran on my device.)
Between the very first time I created my profiles and the date my development profile expired, I upgraded to the 3.1.3 Xcode SDK.
It seems that this now means you need 2 entitlements files; a debug version with the get-task-allow checked and a distribution version with get-task-allow unchecked. Each need to be set in the respective settings.
In Project settings, I needed to set both my working directory and intermediate directory to the build product directory.
BIGGIE - I had to double click on the target and reset the appropriate code signing profile. There was an old profile name still there for some reason! Now, I can debug, and drop my distribution on my device without a hitch.
So, in summary, I believe that my original problem (not being able to debug after renewing my dev profile) and the problem that resulted from all my efforts to fix the first were caused by:
the fact that I upgraded to 3.1.3 during my dev cycle
my own oversight (I apologize to Apple for my criticism)
an Xcode quirk (the old profile name hanging around in target settings).
I hope this helps others. The best advise I can give is to take a day off and then create a new empty project, going through the same process step by step.
Thank you all!!
Try re-creating your development mobileprovision file on Apple's site. Be sure to delete all old copies from Organizer (including those on the iPhone itself).

iPhone adhoc distribution without entitlements

I'm trying to make an ad-hoc distribution of our app for sending to another company for beta testing. They are asking me to remove the Entitlements.plist file from my project.
As far as I know that file is absolutely required and I get a code signing error if it's not there.
Is there a way to build an iPhone app for distribution without an Entitlements file?
AFAIK the entitlements.plist file is essential. Your ad-hoc distribution will fail without it. But it seems it is unnecessary in distribution build.
Out on a limb: What they may actually be seeing is a problem between their OS and .mobileprovision file which throws an error referring to entitlements. Are they seeing an error about the entitlements file when they try to sync the app with the phone?
I have seen this recently and am not fully sure of the answer. I think that on some Macs (i'm thinking 10.5) iTunes is not associated with the .mobileprovision file. I have seen this twice now. The first time the answer was to have the person do an "Open With" on the .mobileprovison file and choose "Other" and then select iTunes. That did the trick.
I have been unable to find an answer to this latest event from tonight. However this person has 10.5 and also XCODE.
I'm still working on this but if you have not found an answer yet, maybe the "Open With" might help.
Good luck.
Update:
I just now go the second issue solved. Email can corrupt the .mobileprovision file. I finally zipped the .mobileprovision file and sent it to those having trouble and it solved the 2nd version of the issue!