Are extra files in my project compiled into my program? - iphone

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"

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 to add bundles and resources like images in that bundle in iPhone

I created bundle using i-phone-OS->resources->setting but I am unable to add images to this bundle. I tried dragging images folder or by adding existing to folder but nothing works.
Thanks in advance
The Settings.bundle is added as a folder/bundle reference and not as a group.
Thus you won't be able to easily add some content to it right from the Groups & Files panel in Xcode unfortunately. Instead, go in the Finder, right-click (or ctrl-click) on this Settings.bundle and select "Show Package Contents" then drag & drop files in there. You will then find the added files back in Xcode.
I also find this kinda anoying in Xcode3 that we can't add files to '.bundle' folders/bundles directly from Xcode3 :( But AFAIK there is no other solution
One your file has been added to the '.bundle', you can edit them directly from Xcode. (Going thru the Finder is only necessary for adding new files to it)

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.

Temporarily restrict certain resources from build inclusion in Xcode?

Is there a way to temporarily restrict which resources are included in the build of an iPhone app (via Xcode)?
I am testing a use case in my app and want to minimize the installation time on my device. I would like to do this by reducing the resources to only those needed by this use case... i.e. there are over 70MB of .wav and .png files that I do not need to copy over.
I am looking for something more elegant than moving the out of the project into a separate directory on the file system.
Thanks in advance!
Try this: duplicate your target in XCode (on the left-hand side of the XCode project window, open "Targets", click on your application target, then choose "duplicate" from the Edit menu).
In the duplicated target, go into the "Copy Bundle Resources" build phase and remove the files you don't want. Switch your "Active Target" (using the menu at the top of the project window) and build.

separate directory for iphone resources

iPhone resources by default show up in a "Resources" group that's visible in the main xcode project view. I want to be able to put them into an actual, physically separate directory at some arbitrary location on my machine decided by me. Interestingly enuf, the default "Classes" group is an actual, physical directory but the "Resources" group isn't.
How can someone tell me how to do that?
TIA,
Howard
Right click on Resources, add existing files, choose your directory
and select "Create Folder References for any added folders".
VoilĂ .
An alternate approach is to start with a directory in your project with some files, drag it into Xcode and have it create the folder references for you. Anything you add within that folder reference is automatically put in that subdirectory.
Both the abovementioned approaches are just how-tos. These operation will transform into build setting. Here is how you can change (or at least just view) the setting on XCode.
If you are using XCode 4+, check the project icon, then select your Target. In Build Phases tab, looking for "Copy Bundle Resources (x items)" category. In it, you should have your folder there. If no, click "+" button.