I am creating my own icons for buttons. I did some snooping around, and it looks like application icons usually go under:
ApplicationName/Contents/Resources/some.png
What do I do to recreate my own structure like this for icons? I don't see any "Content/Resources" in Project navigator.
Xcode will move the icons to the Resources folder in your app package automatically during a build.
Just add the icon files to your Xcode project and it will detect that they are image resource files and add them to the Copy Bundle Resources build phase for you. Any files that are included in the Copy Bundle Resources build phase will be copied to the Resources folder in the built app's bundle.
It doesn't matter which group you put the images into in the Xcode files list because the file group organisation is ignored in the built product, so feel free to put them where you like. I often create a Media group with subgroups such as Images and Audio but it's completely up to you.
Related
I have multiple Xcode Projects in my Dropbox so I can use them on my iMac and MacBook. But when I open the projects on another Mac most of the imported Images, Videos etc... are red (missing). the files are all in the Project Root Folder. What can I do?
This error is because when you added the files (images, documents, etc) you did not tick copy if needed option.
That means if you deag/drop items from your desktop to the project, Xcode will reference the documents from your desktop. When opening the project on another computer, the Xcode is not finding your documents in the desktop of the other computer, thus the error.
Solution:
1- Delete all the red marked items (take note of them)
2- move them again to the project and make sure to check copy items if needed checkbox.
3- re upload the project to wherever you need and it will run.
Happy coding!
I recently used a system tool which removes 'junk' files to free space up. It deleted every single photo on my hard drive... My xcode code is present for an application I have but can I recover the lost app photos from an xcode archive which still exists? Many thanks, as I can't update my app anymore because of it.
If you can get the ipa that is a zip file, change the extension from .ipa to .zip and double-click to unzip.
That will produce a folder named Payload and in that folder is the app.
The app is a is a package, right click on it and "Show Package Contents".
All your images in the app will be there.
Additionally, if the images were added as Assets there will be an additional step to extract the images form the Assets.car file. See this SO Answer for extraction information.
When I create an project of OS X normally, and then build it. When I click "Show Package Contents" on the target app, in its ./Contents/Resources directory, all resources (nib files, image files, sound files, etc) are put together.
Now there are several questions:
<1> Can I hide my nib files from user to keep the completeness of it?
<2> This may similar with the first one: can I package other resource files or encrypted them in on or several target file so that user could not modify them? Just like Windows applications do?
<3> Can I organize my resources by directory in target package content? For example, if I show the package content of Firefox, all files are organized pretty.
1) .nib files are readonly by default in XCode 4, the user cannot view or edit them.
2) Binary encryption can be done perhaps adopting from iOS to osx: Executable encryption check anti piracy measure
3) Organization can be done via drag and drop of folders: Create your folder in the filesystem, then drag it to the resource folder in XCode. In the following dialog select create folder reference for any added folder. The folder should be blue. This folder is copied to your bundle with its contents.
I want to move my open frameworks project to other machines for testing. but when I try to open a build product (exported via the organizer) the app starts up without the text I set (via ofTrueTypeFont). It also won't load any data from the xmls I use. This also happens if I open the exported product on the same machine.
fonts are loaded like:
in .h
ofTrueTypeFont fontLarge;
in .cpp
fontLarge.loadFont("font.ttf", 35);
fontLarge.drawString("Display that String", 30,30);
I have tried various build phases. copied the .ttfs and .xmls to various directories but the app won't find it.
tried a (/bin)data folder within /App/Contents, /Frameworks, /usr/... every folder that i could imagine in the final product. What am I missing here?
Xcode 4.6 / OS X 10.8.2 / OpenFrameworks 0073
Not sure if it's the best approach but this is how I solved it:
Add to your application setup:
ofSetDataPathRoot("../Resources/data/");
Then add a Copy Files Build Phase to your Target and set the Destination to "Resources" and Subpath to "data". From now on you may drag and drop the files you need into the Build Phase and they will be included.
I am developing an iPhone app and there will be a Full as well as a Lite version of that app. In order get both bundles from the same source code and Xcode project I added another target to the Xcode project.
Now, I want to have the Lite target copy only a subset of the resource files to the bundle. But, Xcode won't simply let me delete individual files from the "Copy Files to Bundle" build step, since I imported all my resources as folder references. I need this in order to maintain a directory structure in the resources directory.
How do I solve this problem? Any suggestions or ideas are greatly appreciated!
In the left-hand panel of Xcode, right-click on the "Groups & Files" bar at the top. Check "Target Membership".
Now you'll see a tick against every file that should be included in your current build target. Untick the ones you don't want, switch to your other target, and repeat.
Instead of manipulating the "Copy Bundle Resources" step of your target, you can right-click resource files or groups (folders), choose "Get Info," and selectively leave stuff out of your Lite build under the Targets tabs of the info window for the file(s) you selected. Doing this on a group (folder) recurses the changes, so using resource groups (folders) is a nice easy way to make separate resources collections for separate builds.