Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deploying resource files from xcode

How does one copy resource files (config/data/image) files to an applictions home directory on the iPhone.

A related question Loading Data Files on iPhone?, received an answer "just add them to your project; Xcode will copy them to the .app bundle when it builds your application".

How does one do this? (If this is a simple question, a manual reference/page# is fine)

I want to be able to copy a file onto the iPhone simulator and open it at runtime. I have tried to do this by adding 'copy file' targets, although I havent been able to find the files at runtime.

I know using property list, or sql lite database is prefered over file io, but I would still like to understand how to achieve this.

like image 897
Akusete Avatar asked Dec 23 '08 02:12

Akusete


1 Answers

In my app, I have a sql lite DB which I just dropped in the root of my project folder and added to the resources folder of my project, and it winds up in the bundle, accessible by the app.

http://img68.imageshack.us/img68/3047/xcoderesourceslw5.png

I assume this will work for any file. I didn't have to write any special targets or operations.

In your app, this file then shows up as follows:

NSString *dbFilePath = [[NSBundle mainBundle] 
                            pathForResource:@"dictionary" 
                            ofType:@"db"]; 
like image 78
frankodwyer Avatar answered Oct 21 '22 22:10

frankodwyer