iOS load file from documents directory

不羁岁月 提交于 2019-12-12 05:11:29

问题


I'm creating a registration app. It has two tabs, one tab is the registration form for students to fill out, and the other gives the user the ability to update the form.

I'm still pretty new to iOS development, as well as Objective-c. Currently I'm saving a .csv file that contains the form data in the documents directory, in hopes that the app user can pull that file off the iPad and open it in microsoft excel. Unfortunately I'm not an Apple Developer yet, so I am not able to test it with a physical device, and I have read the documentation but didn't find what I was looking for.

Is this possible? If not, what is the best way to save a file and then have the ability to upload it to a computer?


回答1:


There is more than one way to provide your users with a way to receive files that are saved in your app (some options already mentioned in the comments).

You can implement several methods and let your users choose their preferred one, taking into account that not all of them would like to use the same method (using iTunes for file sharing is not for everyone for example).

So here are the options you have, there are probably more but I think this would be enough for this purpose:

  1. Email the file as an attachment
  2. Upload the file to a 3rd party service: Dropbox, Google Drive, iCloud, Evernote, etc.
  3. Upload to FTP.
  4. iTunes file sharing. You can allow users to access files in the documents folder via iTunes. Look for info about the UIFileSharingEnabled key.


来源:https://stackoverflow.com/questions/31709727/ios-load-file-from-documents-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!