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

When I run the Application then warning display below,
Warning: The Copy Bundle Resources build phase contains this target's Info.plist file 'UserDefinedLocalization-Info.plist'.

I had this issue after I rearranged the underlying file structure of my project. Xcode4 has moved things around though and most online help to this problem is Xcode 3 specific, so this is how you solve this in Xcode 4:
Click the project icon in the Project Navigator (the blue root icon)
In your main pane menu you should be able to choose between your project or targets, select the target
Select "Build Phases" in the top menu
Open the "Copy bundle resources" item
Remove your plist file from there (your plist file should not be copied as a part of the bundle)

In xcode, right click the UserDefinedLocalization-Info.plist file, select Get Info. Go to the Targets tab and remove the checkmark in front of your target.
The info.plist is a special file and must be treated in a special way. It's not allowed to add it to the app in the normal way.

Related

How to change location of iPhone app icon?

Okay, I am a noob. It must be simple but I stuck here.
I do rigth-click and choose 'select file'.
After I choose the file the dialogue appears:
I want to keep my icons not in the root directory. But I can't figure out how to do this. I tried different ways, even create project from scratch...
Please help.
When you bring image assets into Xcode they will all be in your application bundle's root directory at run time.
It appears that you've added a file named "icon#2x.png" to your project at one time already. Go to the project's summary page in Xcode click Build Phases and then expand the section titled Copy Bundle Resources. There you'll find the reference to the resources that will be copied to your bundle at run time.
More on bundle structures here:
https://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html
Anyway, the way I've done this in the past is to:
Remove the existing image duplicate from Xcode and from the folder structure in Finder.
Add a new folder in Finder call it "/AppIcons" (or whatever).
Copy all the app icons to that folder in Finder.
Drag the "/AppIcon" folder into your XCode project. I typically put images in an "/Images" subdirectory in the Xcode project. Again you can put it wherever you'd like.
In Xcode on the project summary panel, add your app icons from the folder "/AppIcons" by dragging / dropping or by right clicking and adding them as separate files.
Alternatively in the past when I've had problems with this sometimes Xcode will copy the app icons to the root project directory. If that happens, I make sure that I have the "/AppIcons" folder structure on disc (in Finder) and in my Xcode project. I add the app icons to the project, then move them to /AppIcons in Finder, and re-reference them all over again.
Your Copy Bundle Resources should then have the proper file reference. Note that my apps icons go in "/Images/AppIcons"
Good luck!
I would add the image files to your project with the name icon#2x.png. To do this right click where you want to add the files in xcode and click add file/s. Then search for your image and add them using the dialogue that pops up. - there is a check box so that you can either copy them to the projects destination folder which will copy them into you project folder or leave it unchecked (inadvisable) which would reference it's current location on your HDD. Make sure the file doesn't already exist in the project before doing this!
EDIT:
Sorry I forgot to mention then drag and drop the file from within xcode onto the image location box.
In XCode 4 (I'm using 4.6.2) you will get this confusing message if you've just moved the target's info.plist file, but not corrected the location at the top of the summary panel. Fix this and the icons will reappear, assuming they are added to the project, or if not you should now be able to drag them in without xcode insisting on making extra copies.
This tends to happen when you're starting a project and sorting out the mess of default file locations that xcode gives you. I like my project structure to be 99% the same as the file system structure.
This is an easy fix. If the image you want as your App Icon resides outside of the root of your project, when you get that dialog just click "Yes", and then click delete on the newly created file in the root, and "Move to Trash".
The reference is still there and works without a hitch, since the file will still be in the root at runtime

How do I keep files not associated with the project in XCode 4 without generating a warning

I recently upgraded to XCode 4 and adjusting. I have a folder called "Unused" in which I keep some .h and .m files. They are basically code which are no longer associated with the project and I keep them because they serve as a reference. The compiler doesn't look what it sees in there so I change the .h and .m files to .h.txt and .m.txt. However, I get this warning:
warning: no rule to process file '$(PROJECT_DIR)/Classes/AddViewController.m.txt' of type text for architecture i386
Does anyone have any solution for this?
Thanks.
Select the target in XCode, then in the Build Phases tab, under Compile Sources, remove the unused files that you don't want. XCode will only compile the files listed.
If you don't want the files to link, you can select the relevant file on the left side project navigator, then go to your right side bar and select the File inspector (left most icon on top right bar), then scroll down to "Target Membership" and unclick the checkbox so the file is not associated with any of your targets.

load XML in iPhone App

I have a problem.
I have a XML and a project (XCode 4.1).
I must build my app with a XML file into this.
Now, where i put a XML file in my project?
In the XCode 3 there is a resource folder but now i haven't this.
Thanks
There should be a Supporting Files folder in your project. You might organize any extra files in this space.
You can put the XML file anywhere you like, so long as you subsequently make Xcode aware of its whereabouts. However, the most straightforward way is probably as follows:
Either:
Make a new group by going to File->New->New Group or
Use the existing Supporting Files group.
Drag the XML file into the group. Xcode will then present an add file sheet. Make sure that "Copy items into destination group's folder (if needed)" option is selected and your target is checked in the "Add to targets" list. Click "Finish".
That's it. Xcode should automatically add the file to the project and include it in your app's bundle.
Should you need to add the file "manually", you can select your project in the Project section of the Navigator pane (press Cmd-1 and select your project at the top left), select your target in the list (just to the right), select "Build Phases" from the tabs at the top and add the file to the "Copy Bundle Resources" build phase.
Just put it in Supporting files group.
I think this should help you.

Can an Xcode project with multiple targets have different Settings.bundle's for each target?

I have a settings bundle in an iPhone app which has several subtle variant targets.
The problem is I need to customise some strings in each settings bundle to make them appropriate for each target. It appears that if the Settings bundle is named anything other than Settings.bundle it won't pick up the bundle (understandable, can I specify in a plist somewhere the alternate name?).
If I try and put them in different folders and call them the same thing Xcode gets horribly confused and lets you edit "2 files" that are actually the same single source.
I see no problem. For every target, create a specific folder with files for this target. Now create a group in Xcode for every of those folders and drag each of the new Settings.bundle directories to the corresponding group. When adding the bundles to the project, make sure that every bundle is only built (included) for its target by checking the appropriate box.
AFter you do what MrMage said which is correct.. i had an issue where the Root.plist would not show up under the Settings.Bundle for a specific target.
You have to let xcode know what the setting.bundle file is... click on the settings.bundle that wont show the Root.plist, then go to file inspector
Alter the file Type drop down to be applicationBundle ... now the Root.plist shows up.

Are extra files in my project compiled into my program?

Lets say I have a bunch of PSD's and other large files that arent being used in my xCode project... Do those get added to the app when I compile? Do I need to store those somewhere else?
I think you can remove them from your target's "Copy Bundle Resources" if you don't want them in your .app file.
By default, they will be included. If you don't want that, then do the following:
In the Xcode project window, select all the resources you don't want included.
Hit the big blue i button on the toolbar.
Go to the Targets tab.
Uncheck your app's target.
Incidentally, this also works if you have a code file you don't want compiled in.
If you want to make sure, go to your build directory and open the .app package and see if the files are in there. Right-click on it in the Finder and choose "Show Package Contents"