how do you export a file out of iOS when using cordova file plugin?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 08:43:18

You have to use itunes file sharing

File-Sharing Support

File-sharing support lets apps make user data files available in iTunes 9.1 and later. An app that declares its support for file sharing makes the contents of its /Documents directory available to the user. The user can then move files in and out of this directory as needed from iTunes. This feature does not allow your app to share files with other apps on the same device; that behavior requires the pasteboard or a document interaction controller object.

To enable file sharing for your app, do the following:

Add the UIFileSharingEnabled key to your app’s Info.plist file, and set the value of the key to YES.

Put whatever files you want to share in your app’s Documents directory.

When the device is plugged into the user’s computer, iTunes displays a File Sharing section in the Apps tab of the selected device.

The user can add files to this directory or move files to the desktop.

Apps that support file sharing should be able to recognize when files have been added to the Documents directory and respond appropriately. For example, your app might make the contents of any new files available from its interface. You should never present the user with the list of files in this directory and ask them to decide what to do with those files.

So, add the UIFileSharingEnabled to your info.plist and set it to YES

https://developer.apple.com/library/ios/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/CoreServicesLayer/CoreServicesLayer.html#//apple_ref/doc/uid/TP40007898-CH10-SW30

@jcesarmobile's answer helped me track down that I needed to enable file sharing in iOS. After confirming that I can enable file sharing by modifying the info.plist file in XCode, I found out that you could directly set UIFileSharingEnabled in the config.xml file but it's a bit more tricky because it's not a standard preference.

<gap:config-file platform="ios" parent="UIFileSharingEnabled" mode="replace">
  <true/>
</gap:config-file>

After putting this in my config.xml file, it worked.

This is noted in the PhoneGap documentation, but I'll admit that it was really buried and a bit difficult to find.

http://docs.build.phonegap.com/en_US/configuring_config_file_element.md.html#Config%20File%20Elements

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