IPhone SDK - How to add application files and folders to Xcode?

I want to package a folder with data specific to my app. The data is just a bunch of binary files in proprietary format.
These files should be installed under /Documents folder of the application. The files themselves will be in a folder called say Data. So when i run the app from Xcode i want it to copy the files to
/Documents/Data folder under the bundlePath.
There could be a file called data.dat under the Data folder.
So in my application i want to be able to use the NSFileHandle interface or the standard C fopen() function to access the file /Documents/Data/data.dat .
How can i do this using Xcode? Is there a tool one needs to use to create an install package?
Any help would be greatly appreciated.
-TRS

If you look at the SQLiteBooks example, it shows and example of installing some extra data (books.sql) into the documents folder. Look at the function createEditableCopyOfDatabaseIfNeeded in AppDelegate.m
You should also add in the starting/static data files in the build process in XCode - you can probably add to, or create another build step that will copy the files from your host machine into the app bundle.

Similar Messages

  • IPhone SDK: How to have application files not be backed up by iTunes?

    We are writing a set of files to the tmp directory on the device, with the expectation that iTunes will not back it up. However, we are seeing that those files are backed up on the host computer.
    The following documentation:
    http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhone OSProgrammingGuide/ApplicationEnvironment/chapter6_section3.html
    says:
    "tmp/ — The application writes any other temporary files here. The application is responsible for cleaning up all files created in this directory; there is no automatic cleanup mechanism. Backup operations ignore the contents of this directory."
    A sample value returned by NSTemporaryDirectory() is:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp
    For which we are saving our files in:
    /private/var/mobile/Applications/65BED698-7789-41A0-A9BC-06BBDC5EB654/tmp/NSData /080702c
    However, when the device is disconnected and reconnected to the computer, and iTunes does a backup, we can see the files from tmp being transferred to a backup directory, eg.:
    ~/Library/Application Support/MobileSync/Backup/fb0a4b743a3c826d3146e0e34a9aa16e3c11eb0c
    Our questions are:
    1. Is the documentation correct about tmp not being backed up?
    2. Are we getting the path to tmp correctly?
    3. Is there something we can do or set to get tmp to not be backed up?
    4. Is there another directory we should be using for data files which need to persist between application launches but not be backed up?
    5. We have noticed that the path returned by NSTemporaryDirectory() is not the same as that formed by adding "tmp" to the path returned by NSHomeDirectory(); the former is /private/var/mobile/Applications/.../tmp while the latter is /var/mobile/Applications/.../tmp. Yet writing files to either seems to put them in the same place - are symbolic or other links being used to make these paths refer to the same directory? Which one should developers use?
    Thanks in advance for any suggestions and help.

    Partly to bump this but also to restate the question in less detail we a) want to save a number of text files for our app to use as a cache when it's relaunched, and b) don't want those files to be backed up by itunes when the iphone/touch is synced with the computer. How to do that?
    We thought the "tmp" directory within our application's sandbox would be the place for that, however, itunes is backing up the files we put there.
    Any ideas or suggestions much appreciated.
    Thanks.

  • How to ZIP the files and folders/sub folder files using java

    HI All,
    I'm New to this Forum, Could anybody tell me how to zip the files and folders/sub folders using java. For example I have a folder with the name testfolder and side that folder I have some files and some sub folders inside subfolders I have some other files. I need to ZIP the files and folders as they are in same hierarchy.
    Any pointers or help wolud be appritiated.
    Thanks,
    Rajeshbabu V

    [http://www.devx.com/tips/Tip/14049]

  • How do you compress files and folders?

    how do you compress files and folders?

    Simply right-click and select "Compress," or navigate in Terminal to the directory containing the file(s) you wish to zip and use the "zip" (no quotes) command. From the terminal you can also use -e to encrypt your archive.

  • How to compress my files and folders, How to compress my files and folders

    Good morning,
    My name is Jai Bhandari and I am from London, UK.
    I am sending this out to everyone that can help me to compress my files and folders, as I believe my macbook pro is starting to freeze and caused by having a slow machine, is there anyone that can suggest to me how and what do I use to compress these files into one folder.
    Thank you for reading this and hope to hear from you soon.
    Many regards
    Jai

    You can 'compress' files and folders from the Finder by selecting the items and choosing File>Compress "selected file or folder". This will create a zip archive and will save you some space. (I just tried it on a 16GB folder and it compressed it to an 11GB zip file). After you zip the file/folder the original can be deleted )until you need to access it again, then you can just double-click the zip file).
    If you're trying to free up disk space on your hard drive, this is not the best method... but you didn't ask about that...
    Clinton

  • How to print the files and folders in a finder window?

    A long time ago...There used to be a way to print all the files and folders in a finder window. I haven't been able to do so in a very long time. Is it one of those things no one else needed so they eliminated it? If not, can someone tell me how to do it?

    Or use the scripts here:
    /Library/Scripts/Printing\ Scripts
    build the droplet in AppleScript Editor, and drag the folder on to the droplet.
    This thread has other suggestions:
    http://discussions.apple.com/thread.jspa?messageID=10825106&#10825106

  • How to recover hidden files and folders from memor...

    When you connect your memory card to a PC or connect your phone as a mass storage device to a PC which is infected by a virus, the virus may hide all your files and folders.
    The virus also changes their attributes to "hidden" and "read only" and may move all memory card content to another hidden folder, though the size of the disk looks unchanged, files are still invisible.
    Steps to recover hidden files and folders:
    First, change the settings in "folder options" so that we can see all hidden files and folders,
    Open any folder > select organise > folder and search options, select view tab and under hidden files and folders setting, select "show hidden files, folders and drives", and uncheck the option "Hide protected operating system files" and click ok, click yes if a prompt appears for confirmation, now you should be able to see all hidden files and folders.
    Second, connect your memory card to PC using a card reader or you can connect your phone as a mass storage device and note down its drive letter. (L) is the drive in my case as shown
    1. If you have autorun.info file, you can manually delete it or use tools like autorun eater(or any other you like).
    If all the folders are moved inside a hidden folder, select all the items inside that folder, cut them and paste them to root directory of your memory card.
    If you select properties of any folder on your memory card, the hidden attribute might be locked as shown:
    To solve these issues, type cmd in the start menu, right click on it and click run as administrator.
    2. In the command prompt window, type the following:
    L: [Press Enter]
    Here, I assume L as your drive letter.
    3. Type the following code to reset the attributes of all the files and folders to their default:
    Attrib *.* -r -h -s /s /d   [Press Enter]
    After few seconds, all the files and folders will be reset to their normal attributes settings.
    Hope you enjoyed reading the post and was helpful.
    -------------------If this post helped you, click on accept as solution.------------------
    -----------------------------Appreciate by clicking on white star.----------------------------

    Check the formatting of the external hard drive. To do that, right click on the drive icon and select Get Info. (Or click once on the drive and type command +i ) The pane includes information about the drive format.
    The drive should be formatted as Mac OS Extended. If it is not, run Disk Utility (App;ications / Utilities) and format the drive.

  • How do I resort files and folders by name in Column View of Finder when Arrange by Name doesn't work?

    I was using the arrange by function to select different arrangements of the files and folders in Finder (column view) but now that I want to return to having them arranged by Name, it is not rearranging the files/folders by name.  Instead they stay in a totally random, non-alphabetical arrangement.  List view sorts without issue by clicking on the column header. It is column view that will not return to arranging by name.  Please help me figure out what is wrong.
    Thank you!

    Repair Disk Permissions in Disk Utility, reboot the computer in Safe Mode then restart normally and test.

  • How to Add JAR files and Config files to CLASSPATH at runtime?

    QUERY:
    During runtime, I need to load the JAR files and relevant config files( .cfg files and .properties file) into CLASSPATH and run a specific java program from one of the JAR which is available in CLASSPATH.
    Please advise me any relevant Java API details or a sample java program to implement the above use case.
    Thanks in advance.

    During runtime, I need to load the JAR files and relevant config files( .cfg files and .properties file) into CLASSPATH and run a specific java program from one of the JAR which is available in CLASSPATH.
    Please advise me any relevant Java API details or a sample java program to implement the above use case.
    You don't add to YOUR classpath once your app is launched.
    You create a NEW process for the app you want to run and provide the proper environment for it to run in - including any PATH or CLASSPATH environment variables.
    The Java API for the ProcessBuilder class has a simple example that shows how to create the arguments and launch an external application.
    ProcessBuilder (Java Platform SE 7 )
    There are also PLENTY of other examples of using ProcessBuilder; just search the net.

  • How to add wsdl files and bpel files in new folders automatically

    Hi All,
    In our project, we have a lot of wsdl files and bpel file generated.
    By default, they are all under the folder of SOA Content, like a mess.
    I want to put them in separate folders.
    I can manually change the wsdl location and manually change references to these wsdls, but it will take a lot of extra time to do so.
    Is there a way to achieve this in UI?
    Thanks and Regards!
    Bruce

    Hi Eric,
    Thanks for your reply!
    I can use refector->move to move the wsdl file to newly created folders.
    But unfortunately, JDeveloper won't update the references to the wsdl files.
    I have to update the references manually, and it will take a lot of time if there exists many wsdl files in one project.
    Thanks and Regards!
    Bruce

  • How to delete all files and folders (with files) in IsolatedStorage.

    Hi awesome programmer:-) The code I have to clean up the local folder doesn't work properly so I won't even bother posting it here. I basically want to have a "master reset" option to remove all new created files and folder in the local folder.
    Can you give me simple code to remove all files/folder so the app goes back to the state it was when the user installed it for the first time? Thanks in advance. ps I were able to delete a directory(-ies) with this method:
    private async void DeleteDirectory(string directoryName)
    try
    var folder = await Windows.Storage.ApplicationData.Current.LocalFolder.GetFolderAsync(directoryName);
    if (folder != null)
    await folder.DeleteAsync();
    this.Dispatcher.BeginInvoke(delegate()
    txtUpdateFeed.Text = "Folder < " + directoryName + " > deleted.";
    catch (Exception ex)
    this.Dispatcher.BeginInvoke(delegate()
    txtUpdateFeed.Text = "Delete Directory << " + directoryName + " >> Error: " + ex.GetBaseException().Message.ToString();
    It seems to work, I have not tested with all conditions though. Anyway let me put up the code so you can see I have been trying: This is to delete everything but not all files are deleted:
    private void WipeAllData(bool bln)
    try
    txtUpdateFeed.Text = "Removing files...";
    if (bln)
    txtUpdateFeed.Text = "Removing folders...";
    //Delete videos directory
    DeleteDirectory("videos");
    //Delete pictures directory
    DeleteDirectory("pictures");
    txtUpdateFeed.Text = "Folders removed.";
    //Delete the rest of the files
    var iso = IsolatedStorageFile.GetUserStoreForApplication();
    foreach (string name in iso.GetFileNames())
    iso.DeleteFile(name);
    BtnWipeAllData.Content = "Wipe All Data";
    VideoCameraPowerValue = "on";
    BtnVideoCameraPower.Content = "Video Camera: ON";
    PhotoCameraPowerValue = "on";
    BtnPhotoCameraPower.Content = "Photo Camera: ON";
    txtUpdateFeed.Text = "Files removed successfully.";
    catch (Exception ex)
    MessageBox.Show("Wipe All Data Error:\n" + ex.Message.ToString());
    Why isn't all files being deleted?

    Hi Clint William Theron,
    Based on your descriptions, I know that when you run the above code, it does not delete all the files, then have you checked that which kinds of files or in which folder the files can not been deleted?
    Besides, if you want to let the app go back to the state it was when the user installed it for the first time, then an easy way is to uninstall and reinstall it.
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Slow iMac/how to identify "other" files and folders

    My iMac has slowed down considerably in the last 8 or 9 months. (OS 10.7.4) I get the beach ball on everything, whether trying to scroll through Gmail on the web, or switch from one application to another.  My photo library is very large (18,000 photos) and it's at a standstill most of the time.  Syncing my iPad can take 30 minutes. I'm working with Apple technician and have reset PRAM, done a disk utility check, and repaired permissions (there is still something wrong there). In the meantime, I'm trying to figure out why my storage is so high.  when I view "About this Mac" and "Storage, it lists Audio, Movies, Photos, Apps, Backups, and Other.   Is the other my Applications, as opposed to Apps?  Is there some way to get a listing of folder sizes?

    How much free space is on the HD, where has all the space gone?
    OmniDiskSweeper is likely the easiest/best, and is now free...
    http://www.omnigroup.com/applications/omnidisksweeper/download/
    Check the S.M.A.R.T. status of the drive in Disk Utilty by highlighting the Drive & looking at the bottom of the window.
    https://discussions.apple.com/servlet/JiveServlet/showImage/2-18909570-134065/SM ARTstatus.gif
    Open Activity Monitor in Applications>Utilities, select All Processes & sort on CPU%, any indications there?
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    How much RAM & free space do you have also, click on the Memory & Disk Usage Tabs.
    In the Memory tab, are there a lot of Pageouts?

  • How do i copy files and folders from one external harddrive to another on the iMac?

    For some reason when i drag the folder or file that i want to transfer or copy from one external harddrive to another, nothing happens when i drop it on the destination folder or drive. however, when i drag and drop to the desktop or any location on the Imac internal hardrive it works without any issue. The only problem is that i dont want to transfer or copy stuff to the computer. i want to copy it to an external harddrive. please help if your have answers to my question.
    Thanks!

    Check the formatting of the external hard drive. To do that, right click on the drive icon and select Get Info. (Or click once on the drive and type command +i ) The pane includes information about the drive format.
    The drive should be formatted as Mac OS Extended. If it is not, run Disk Utility (App;ications / Utilities) and format the drive.

  • Compress files and folders in OS 10.6

    How do I compress files and folders in OS 10.6?

    If you have Compressor, there are many options to compress files.
    If you don't, there ere some QuickTime h,264 options available as well,
    But since you mention folders, I'm guessing that you're not referring to AV files specifically but to zipping generically. If so, right click and choose the Compress  option.

  • How to add new row and update existing rows at a time form the upload file

    hi
    How to add new row and update existing rows at a time form the upload file
    example:ztable(existing table)
    bcent                      smh            nsmh         valid date
    0001112465      7.4                       26.06.2007
    0001112466      7.5                       26.06.2007
    000111801                      7.6                       26.06.2007
    1982                      7.8                       26.06.2007
    Flat file structure
    bcent                       nsmh         valid date
    0001112465     7.8     26.06.2007  ( update into above table in nsmh)
    0001112466     7.9     26.06.2007  ( update into above table in nsmh) 
    000111801                     7.6      26.06.2007 ( update into above table in nsmh
    1985                      11              26.06.2007   new row it should insert in table
    thanks,
    Sivagopal R

    Hi,
    First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
    Then :
    Loop at it.
    *insert or modify as per your requirement.
    Endloop.
    Regards,
    Srilatha.

Maybe you are looking for