In my app I have to upload files to server.
For that I need to view and choose files from my iPhone and iPad. (any kind of files i.e pdf , doc,dock , mp3 etc etc).
How can I get the path for these files and how can I choose them in my application.
Generally in iPhone Where are these files are stored? how we can fetch them in our application?
Is there any thing like UIImagePickerController to pick file from iPhone?
There are classes that allow you to interact with various media types that may be on an iOS based device.
As you mention UIImagePickerController.
For music, you can use a similar class: MPMediaPickerControllerDelegate.
With regard to other arbitrary documents;
There is no device-wide document store, and you cannot access files stored inside another app's app bundle, thus you cannot access saved PDF/doc files. There is no shared place for the user to save such PDFs in the first place. Which is why media libraries have specific APIs to access them because they are device-wide libraries.
The most you can do is register your app as a viewer of PDF documents. This would allow other apps to open a PDF in your app if they use a UIDocumentInteractionController.
Your best option is probably to use File Sharing which will allow your application to own files on the device which can be synced via iTunes.
This will enable you to create your own UI, to present these files from your applications document folder.
Further reading: iOS File System Basics, File System Programming Guide.
Related
Is there any way to open link from dropbox app to my own App ?
I want to play audio file from dropbox app to my app.
Thanks.
The solution for this isn't specific to Dropbox.
You need to setup your app to indicate that it can open certain types of files (such as audio files). Once you do that, then any app, such as the Dropbox app, that offers an "Open In" option for those types of files will show your app as one of the options.
To learn how to register your app for certain types of files, see How do I associate file types with an iPhone application?
Right now, the PDFs I download on my app are being stored in the app's document directory and can be retrieved only within the app. Is there any way to store the PDF files in the common documents directory that can be accessed by other apps?
If not, is there a way of storing my downloaded PDFs in other apps' documents directory (let's say iBooks), so that it will always be stored in iBooks.
If there are any ways, please elaborate.
There is no "commun documents directory" on iOS, each App is launched in is own sandbox and cannot access the files from other app directly.
I suggest you to check the iOS File System Basics guide from Apple in order to understand better what's happening behind the scenes.
You can still use an UIActivityController in your code to perform an export of your pdf file to iBooks or any app accepting this kind of file, but it requires some user interaction.
I am designing an ios app which collects the user data and saves the data into a .txt file. I am currently using the sandbox in organizer in xcode to download these files. However, I want the users who do not have xcode to access these files as well.
So are there any ways that I can download these files either via USB, or via FTP to a server, or via iCloud, or via Bluetooth, or via WIFI?
iTunes File Sharing would probably be the easiest method of getting files out of your app. You basically just add the UIFileSharingEnabled key to your app's Info.plist, then save the file to the sandbox's ~/Documents/ directory.
Here's a tutorial if you want a more in-depth discussion of how to use file sharing.
Probably most easiest way is to dump file content to UIPasteboard.
I'm making a video decoder application on iOS using Xcode 4.2.
On click of a button I need to choose an input file to decode from a list of files.
Since there is no File Manager or File Browser on iOS, is there any way to go about this?
As others have pointed out, there is no iOS file manager. What there is the FileManager class. This class provides you the ability to:
get read-only access to items in your app package
get read/write access to your app's sandboxed container
You cannot access files elsewhere on the device, nor files belonging to other applications.
Some iOS applications (camera, pictures, contacts, etc) can be interacted with in a limited fashion by iOS API's that apple provides for that purpose. You can get more information about this in the apple developer docs online.
Thus, if your files are in your local app sandbox you can use FileManager to manually build a UI that allows users to see lists of the files there and pick one. They key being "you can build" on top of FileManager's functions for accessing the file tree.
For a school project, I am writing an iOS iPad application in which the user is capable of inputting sentences into core data that are used elsewhere in the system; however, my professor has now asked for another feature in which the user is capable of somehow entering sentences from some other interface than the iPad's keyboard. For instance, the most desirable solution is to be able to write sentences into text files and import them into the application through iTunes.
I have seen a few different apps capable of receiving files through iTunes, such as the VLC app in which the user can place videos into the VLC app's video storage. This allows VLC to then load the videos. I'm wondering if there is a good way or even if it's possible to do this with text files in my app, so that I may then read them into core data.
Thanks,
Chris
This is possible... First of all you need to add a value to your info.plist file which enables iTunes file sharing (like with VLC etc.) "UIFileSharingEnabled -> YES"
Then you can store files through iTunes. These files are put into your applications "Documents" - directory... When launching your application, you will need to check if new files are available and handle these changes...
You can also add document types / extensions, so that when you are sent an email with a txt file, it can be opened with your application. How do I register a custom filetype in iOS