How can you import text files into an iPad application?
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开发者_Python百科 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
精彩评论