Archiving project in Xcode incorrectly creates multi-application bundle
Asked Answered
W

5

170

Archiving my project in Xcode is creating a multi-application bundle, instead of bundling my main target for release, which is what I want. Specifically, when I validate my archive in Organizer, it gives me the message:

"[projectname] does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application."

It sounds like there is some setting in the scheme that needs to be adjusted, but I can't figure out what's causing other targets to be included.

I'm using Xcode 4.0 by the way.

Wabash answered 5/3, 2011 at 20:18 Comment(1)
W
251

OK, answering my own question. Turns out it is an issue with dependent projects in XCode 4. If this happens to you, go through the Build Settings for all your dependent projects (e.g. static libraries) and make sure that the "Skip Install" option under "Deployment" is set to YES.

More detail here: http://flakasoft.com/developer-tips/xcode-4-bug-solution-for-archiving-build-with-static-library/

Wabash answered 5/3, 2011 at 20:40 Comment(9)
Changed it to "YES" ... still failing. :(Crosscurrent
Skip Install needs to be set to Yes on the static library only, not your Project or Target. This blog post on ad hoc distribution applies equally to app store builds and has a section on Skip Install: musicalgeometry.com/?p=1237Wyattwyche
i'll second that Skip Install needs to be set to Yes on the static library only, not your Project or Target.Sphingosine
Some libraries (like CorePlot) require you to change the Copy Headers section of their build phase, too. So make make sure you look at Ryan's answer, too.Pouliot
Thanks Jared! Just ran into this after opening an old Xcode 3 project in Xcode 4.2. This fixed it.Incumbent
That is the solution indeed! But the XCode generates a folder structure for me and there's a separate folder for my library (an .a file). Does this mean that the .ipa was compiled without the library?Softhearted
I also have to move all the header files (of the static library) in the Target "Build Phases", in "Copy Headers" I moved them from "Public" into "Project".Heddy
You don't need to remove headers from the copy headers phase - simply under Packaging, set the Release value for Private/Public Headers Folder Path to an empty string - and that's it.Pilgarlic
An additional step which I found necessary was to Edit Scheme and under "Build" uncheck the box for "find implicit dependencies."Yellowwood
A
151

Two things needed to be fixed in the sub-project(s) to resolve this issue:

  1. As Jared discovered, under the Build Settings, set the "Skip Install" to "Yes"
  2. Under the Build Phases, examine the Copy Headers section. If there are any header files listed as Private or Public, drag them down to the Project section.
Ancillary answered 15/3, 2011 at 21:59 Comment(17)
I fixed all the "Skip Install" settings but what I was missing was the Copy Header section, Thanks!Microcline
I'm using three20. This project has header files listed as Private or Public but if I move them in the project section it doesn't compile. Any suggestion?Malvin
Stop using Three20, even if you do get over this Xcode issue. I'm completely serious!Breakout
@Breezeight: Did you ever manage to successfully create an archive for submission with three20? If so, would really appreciate if you could let us know how you resolved it as we're using three20 (unfortunately) in one of our projects and are unable to submit at this time.Moke
Ryan - nice one, you saved my a$$ when trying to make a build with Core Plot...thanks a bunch!Shack
@Fulvio - by default three20 had its targets skip install set to YES - I didn't need to change anything on any of my three20 projects in 4.2. I also didn't need to move the public/private headers into project.Hinduism
@Ryan: Sorry to say, but it didn't fix mine! I still get this warning in XCode 4.3.1. Previously it created the app correctly but now it doesn't! In every three20 Application i included in my project, is set the 'Skip Install' setting to YES and in my project i set it to NO (so it should create an App Archive, but it doesn't). When i move some of the three20 Public headers into the Project Section (in the Three20-subproject's buildphase) and when i try to create an archive than, it tells me that there is an error, but nothing specific! What am i doing wrong?Aide
@Ryan: With previosly i meant with an older XCode versionAide
@Fulvio: I think, you can only/simply get across this, by only using the source code of the three20 library!Aide
I had this problem with a different cause: I had a target in my project (not the main target) that I created as a console tool, and Xcode had automatically created a man file for it and a copy-files build phase to install the man file in a public location (/usr/share/man). Once I removed this build phase, the error disappeared.Langur
If you have numerous library projects like we do and having a hard time figuring out which library's Skip Install is set to No or which header files are causing the problem try this: Select the archive and click the Distribute button. Select the 'Save Built Products' option. Hit Next and Save. Browse the created directory in Finder. The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes. The usr/local/include will identify the culprit header files you need to move from Public to Project.Erastianism
I'm wondering why this works for everybody, because, if I set the public headers of my static library to project, the app no longer compiles, because, well, the headers are no longer public. Do you all copy the headers into the app project?Ilk
@Moke so did you figure the three20 problem out? I tried moving the headers to project but then i'm getting compilation erros like everyone elseArp
@Aide so did you figure the three20 problem out?Arp
@Arp Yes, i fixed the compiler errors by removing the "three20" (or so) of every imported header in every file (also in the three20 classes). Eg: #import "tree20/TTCoreProcessMacros.h" to #import "TTCoreProcessMacros.h". It took very long, to manage all this (even though with a quick replace), but its the only solution, that worked for me!Aide
@Aide you did the the two steps above as well to make it finally work right? also.. you're talkinga bout Three20* I mean that also would include Three20Core, Three20Network etc right?Arp
@Aide tried that but didn't work.. at the end i just too three20 out as a subproject/static library from my main project and used cocoapods instead (see answer above)..Arp
A
10

I did the following to make it work for me:

  1. for the three20 static library, I used cocoapods to include the files within the main project.. it just got rid of all the trouble three20 was giving me (and they are lots..) btw i tried replacing three20 with Nimbus.. but Nimbus was lacking on some of the features that my project was using three20 for.. so Nimbus wasn't helpful.
  2. set skip install to yes under build settings for all other sub projects/static libraries and switched the copy headers from public to project under build phases
  3. most importantly: under the sub libraries.. under build phases i ensured that copy files destination was changed from Absolute path to products directory.

and that was it!

hint: to get an idea of the offending files that's causing your archive to create an archive file rather than an ipa do this:

  1. Select the archive and click the Distribute button.
  2. Select the 'Save Built Products' option.
  3. Hit Next and Save.
  4. Browse the created directory in Finder.
  5. The 'libraries' subdirectory will identify the libraries that you need to set the Skip Install to Yes.
  6. in some cases usr/local/include will identify the culprit header files you need to move from Public to Project or the files that you have to change from absolute path to products directory. but that directory (ie usr/local/include) varies depending on your sublibrary directory structure
Arp answered 27/2, 2013 at 19:9 Comment(6)
I would give you 10 stars, the nr of solutions i read till finding the one that helped. I just clicked on the files i found at step 6 and marked them in the target membership area from public to project, no need for anything.Stellular
glad i could help! the reason i wrote it up was b/c i went through what you did.. i read like maybe 20 answers before i started understanding what was going on.. :)Arp
Can someone please explain step 6? I don't understand what "usr/local/include will identify the culprit header files" means and where/how should i check those filesMalm
@CristiBăluță How exactly did you find the files and where in the settings/menus? I have the same issue with XCode 11.2.1 and I don't have much experience with xcode. Thank you.Malm
What i found is that /usr/local/include is a folder inside the archive (along with libraries folder), but my generic archive doesn't have any of thoseMalm
@AndreiF Unfortunately i'm looking at the message and have no idea what i was talking about, doesn't sound as something is intended we do. I saw this error over the years on mac apps with launchers and was because of the "Skip Install" option on the launcher.Stellular
B
1

I had a copy files build phase I forgot about (copied some fonts into ~/Library/Fonts). After removing this build phase, it worked fine.

If none of the above answers fix the issue, I recommend exporting the archive to the finder and taking a look what's outside the .app bundle.

Edit: see https://github.com/RestKit/RestKit/wiki/Xcode-4-Archiving-Issue:--'Does-not-contain-a-single-bundle'

Barbette answered 22/2, 2013 at 15:39 Comment(0)
E
0

i also had this same problem "[projectname] does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application." after upgrading to xcode5.

the problem was that a bunch of fields in my build settings for 'release' were blank. I guess xcode4 automatically switched to the debug setting.

anwyays - my fix was to find all those 'release' settings that were blank and set them to the debug setting. In particular it was the Info.plist file setting.

Evangelin answered 8/1, 2014 at 3:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.