277

I've separated a project into two builds and given each of them a plist file. Everything works fine, but I keep getting this build warning:

Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'MyApp-Info.plist'

I get this when I try to build MyApp. Building for the second target gives the same error (with SecondTarget-Info.plist in the warning). I'm not sure why it's a warning, since I want the build to contain that .plist file. Each of the .plist files have one target membership (for their own build).

What does this warning mean? Is there any way to make it go away?

nevan king
  • 112,709
  • 45
  • 203
  • 241
  • You don't need to add Info.plist to each target. Instead in each target Build Setting -> Packaging -> Info.plist File -> the location to the target Info.plist – onmyway133 Jul 07 '15 at 04:36

6 Answers6

622

https://developer.apple.com/library/content/qa/qa1649/_index.html

Excerpt:

You are getting this warning because you probably added your Info.plist file to your Copy Bundle Resources build phase as shown in Figure

enter image description here

The INFOPLIST_FILE build setting specifies the name of the Info.plist associated with your target. When building a target, Xcode reads this build setting and copies the referenced Info.plist into your application bundle. Because Xcode automatically processes the Info.plist, you should not add it to your Copy Bundle Resources build phase or make it a target member.

To resolve this warning, select your Info.plist from the Copy Bundle Resource build phase as shown in Figure 1, then click the Remove (–) button to delete it from the phase.

Community
  • 1
  • 1
JWWalker
  • 22,385
  • 6
  • 55
  • 76
  • What problem will be caused if this didn't get solved? – hasan Jan 15 '15 at 17:00
  • 2
    @hasan83, you will get the build warning, and the built product will contain an extra copy of Info.plist taking up a little space. – JWWalker Jan 16 '15 at 01:01
  • Not working for me. I get this warning but the Info.plist doesn't appear in the 'Copy Bundle Resources' list so I can't remove it. I tried selecting the file in the File Inspector and then removing target membership but that didn't get rid of the warning either. – kraftydevil Aug 18 '15 at 20:28
  • 1
    @kraftydevil, does your project have any subprojects, so that the warning might be referring to a target other than the one you examined? – JWWalker Aug 18 '15 at 20:36
  • It's a workspace using cocoapods so it it has the main project and the pods library project. I am sure the plist in question didn't refer to another target because I could see all the targets in the File Inspector and only the target in question was checked. Deleting the reference and re-adding correctly fixed my problem: http://stackoverflow.com/a/6602567/869936 – kraftydevil Aug 19 '15 at 21:25
  • 9
    Still relevant, 7 years later. – jungledev Jan 03 '17 at 09:08
  • 1
    The solution worked for me on Xcode 9. @jungledev still relevant because Apple is busy updating Swift versions rather than developing Xcode to show us the solution for the weird errors of weird numbers all the time. – MBH Oct 27 '17 at 12:15
  • i find myself looking this answer every a few years when i change whole project naming and structures of directories – EFE Feb 15 '19 at 14:40
66

To fix in xcode 4:

1) Remove the reference to your info.plist file by selecting it and hitting delete.

2) Add the info.plist file again but choose no destination and uncheck the "add to targets" option.

Buchannon
  • 1,671
  • 16
  • 28
  • 2
    I see now that NOT unchecking "add to targets" when copying the plist file in to my project was the reason I got this problem. To fix the problem, I followed the steps in the "correct answer" above though deleting and re-adding without adding to targets would have worked as well. =) – RanLearns Nov 15 '11 at 16:21
  • 1
    This worked for me in Xcode 6.4. The selected answer did not. – kraftydevil Aug 18 '15 at 20:33
  • Looks like in the newest version of the XCode there is no such option like `no destination` or `add to targets`. The only option I see is to the the file without any addition option. – Sirop4ik Jan 06 '22 at 12:21
  • OutStanding ...... uncheck the "add to targets" option. – M Hamayun zeb Jun 18 '22 at 02:41
2

In case anyone runs into this with Xcode 3, to fix it click on the .plist file in the left column under "Groups and Files", and in the upper right area, uncheck the box next to the .plist file's name in the column under the bullseye icon. You'll need the editor zoomed out (View -> Zoom Editor Out) to show the checkboxes.

Marc
  • 324
  • 1
  • 9
1

Another solution is:

You might have accidentally removed a project file from the "target membership" core data.

  1. Select your Main.storyboard from the project navigator on the left

  2. Go to the "file inspector" (first tab) on the right

  3. Find the "Target Membership" list

  4. Enable the check box

  5. Give it a little time to process, but while your at it, also check the LaunchScreen.storyboard, .xcdatamodelid, Assets.xcassets, and all .swift files in your project. They should all have been enabled for target membership.

  6. Note: the Info.plist should not have the target membership checked enabled.

Hope this helps.

CrazyOne
  • 605
  • 7
  • 13
0

For me, this was related to this ionic framework post

The only difference was that I changed the

CODE_SIGN_IDENTITY = iPhone Distribution
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution

to

CODE_SIGN_IDENTITY = Apple Development
CODE_SIGN_IDENTITY[sdk=iphoneos*] = Apple Development

instead of "iPhone Developer" as described in the post, as per Xcode's own suggestion. Also, I am using cordova not ionic. If you are too, this file is located in platforms/ios/cordova/build-release.xconfig

ps: remember to have your project's signing settings as automatic (even unckecking/checking it again helps)

ce-loco
  • 262
  • 4
  • 10
-3

Just as a note... I'm gonna try to write a nice Radar about it, but it's really weird the way Localization is handled in Storyboards in Xcode. If you ask "Show in Finder", you won't see your .storyboard file selected but instead its containing folder. I think it has to do with Localisation of the Storyboard. As soon as I changed that from English to German (and thus not having the file anymore in either root or en.lproj), I started to have trouble.

StuFF mc
  • 4,137
  • 2
  • 33
  • 32