Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Transfer file/data via itunes to the app


I want to let user transfer a text/csv file to my iphone app via the itunes interface, instead of using the 'normal' way of using the net.

Can that be done?

— asked August 3rd 2010 by Peter Lum
  • itunes
  • text/cvs
  • transfer

6 Answers

  • Accepted Answer


    Apple added File Sharing through iTunes support in iOS 3.2 and newer and it should be simple to add to your iPhone app:

    1. Copy the Info.plist file from your build/iphone folder to your project's root folder (where tiapp.xml is located)

    2. Add the UIFileSharingEnabled key to your Info.plist file and set the value to YES.

    3. Users will now be able to sync files when their iPhone is connected with iTunes under File Sharing section in the Apps tab.

    4. Users will have access to any files put into your app's Documents folder on the iPhone, and all files added by a user in iTunes should end up in that folder on the device after syncing.

    I believe you can get the path to the documents folder by using Titanium.FileSystem.applicationDataDirectory.

    — answered August 3rd 2010 by Goran Skledar
    • Thanks!

      — commented August 19th 2010 by Nicolas Arcay Bermejo
    • It's actually Titanium.Filesystem.applicationDataDirectory (No capitalisation on System).

      — commented November 12th 2010 by Xiao Jin
    • Are these instructions still valid? They don't seem to work for me. I don't see my app listed in the window for the itunes files sharing.

      — commented October 4th 2011 by Leonardo Amigoni
  • Rather than copying over Info.plists etc the newer SDKs (I think 2.1+) allow you to put this config in tiapp.xml
    like so:


    A listing of the contents can then be got into an array by:

    var listing = Ti.Filesystem.getFile( Ti.Filesystem.applicationDataDirectory() ).getDirectoryListing();
    — answered January 18th 2013 by Neville Dastur
  • bonjour? Is this the right word?

    — answered August 3rd 2010 by Peter Lum
  • Thanks, Goran! This is excellent news!

    — answered August 3rd 2010 by Peter Lum
  • Awesome Info. Thanks I will check this out.

    — answered October 4th 2011 by Leonardo Amigoni
  • What I did was add this to tiapp.py

    Or if you want it for just one of your apps:

    if appid == 'com.example.awesomeapp':

    Because sometimes the info.plist seems to get overwritten. Of course if you update your Titanium mobile SDK you need to make sure you add this line to the new version of tiapp.py everytime.

    It would be great if Appcelerator could make this an option for the mobile project.

    — answered October 20th 2010 by James Low
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.