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?
Apple added File Sharing through iTunes support in iOS 3.2 and newer and it should be simple to add to your iPhone app:
Copy the Info.plist file from your build/iphone folder to your project's root folder (where tiapp.xml is located)
Add the UIFileSharingEnabled key to your Info.plist file and set the value to YES.
Users will now be able to sync files when their iPhone is connected with iTunes under File Sharing section in the Apps tab.
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
Rather than copying over Info.plists etc the newer SDKs (I think 2.1+) allow you to put this config in
<ios> <plist> <dict> <key>UIFileSharingEnabled</key> <true/> </dict> </plist> </ios>
A listing of the contents can then be got into an array by:
var listing = Ti.Filesystem.getFile( Ti.Filesystem.applicationDataDirectory() ).getDirectoryListing();
bonjour? Is this the right word?
Thanks, Goran! This is excellent news!
Awesome Info. Thanks I will check this out.
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.