iOS如何让程序能够支持文件共享
2016-12-19 18:03
411 查看
http://blog.csdn.net/my_programe_life/article/details/49744673
由于iOS的沙盒机制,苹果用户就不能像安卓用户那样能够直接往手机里拷自己喜欢的音视频文件,如果你的程序支持拷贝文件进去,并且能够显示在程序中。
那么就需要以下配置了:
You can copy files between your computer and apps on your iOS device using File Sharing. For example, you can create a document in Pages on your iPad, then copy it to your Mac so that you can open it in Pages for macOS.
Instead
of File Sharing, consider using iCloud Drive, Handoff, or AirDrop to keep your documents up to date across all your devices.
iCloud Drive lets you securely access all of your documents from your iPhone, iPad, iPod touch, Mac, or PC. No matter which device you’re using,
you'll always have the most up to date documents when you need them.
With Handoff, you can start a document, email, or message on one device and pick up where you left off from another device. Handoff works
with Apple apps such as Mail, Safari, Maps, Messages, Reminders, Calendar, Contacts, Pages, Numbers, and Keynote. Some third-party apps are also compatible.
AirDrop lets you share photos, videos, websites, locations, and more with other nearby Apple devices.
The latest version of iTunes.
The latest version of macOS or an up-to-date version of Windows 7 or later.
An iPhone, iPad, or iPod touch with the latest version of iOS.
An iOS app that works with File Sharing.
Open iTunes on your Mac or PC.
Connect your iPhone, iPad, or iPod touch to your computer using the USB cable that came with your device.
Click your device in iTunes. Get help if you can't find it.
In the left sidebar, click Apps. Then, scroll to the File Sharing section at the bottom of the page.
Select an app to see which files are available for sharing in that app on your device. If you don't see a File Sharing section, your device has no file-sharing apps.
In iTunes, select the app from the list in the File Sharing section.
Drag and drop files from a folder or window onto the Documents list to copy them to your device.
You can also click Add in the Documents list in iTunes, find the file or files you want to copy from your computer, and then click Add. iTunes copies these files to the app on your device. Choose only files that will work with the app. Check the app's user
guide to learn which kinds of files will work.
In iTunes, select the app from the list in the File Sharing section.
Drag and drop files from the Documents list to a folder or window on your computer to copy them to your computer.
You can also select the file or files that you want to copy to your computer from the Documents list and click "Save to," then find the folder on your computer to which you want to copy the files and click Save To.
On your iOS device, you can open the files from your computer with the app that you chose for File Sharing.
You can't access these files from other apps or locations on your device. You can see the list of files in the File Sharing section
of iTunes when your device is connected to your computer.
When iCloud (or iTunes) backs up your device, it backs up your shared files as well.
If
you delete an app with shared files from your iOS device, you also delete those shared files from your device and your iCloud or iTunes backup. To avoid losing shared files, copy
the files to your computer before deleting the app from your iOS device.
To delete a file you copied to an iOS app using File Sharing, follow these steps:
Open iTunes on your Mac or PC.
Connect your iPhone, iPad, or iPod touch to your computer using the USB cable that came with your device.
Select your device in iTunes. Get help if you can't find it.
In the left sidebar, click Apps. Then, scroll to the File Sharing section.
Select the app with the file that you want to delete.
Select the file that you want to delete in the Documents list, then press the Delete key on your keyboard.
When iTunes asks you to confirm, click Delete.
There might be other ways to delete files from an app. Read your app's user guide to find out more.
Published Date: Sep 22, 2016
由于iOS的沙盒机制,苹果用户就不能像安卓用户那样能够直接往手机里拷自己喜欢的音视频文件,如果你的程序支持拷贝文件进去,并且能够显示在程序中。
那么就需要以下配置了:
在应用程序的Info.plist文件中添加UIFileSharingEnabled(Application supports iTunes file sharing )键,并将键值设置为YES。
这时你再连接手机运行程序,是不是就可以在itunes里面找到你的程序了,而且可以向里面添加文件。
而在程序中这些文件都是存到Documents目录下了
当需要显示这些文件时,可以找到Documents 的路径,然后直接取数据就行了,关于文件操作,将放在下一篇iOS文件操作来讲
https://support.apple.com/en-us/HT201301
You can copy files between your computer and apps on your iOS device using File Sharing. For example, you can create a document in Pages on your iPad, then copy it to your Mac so that you can open it in Pages for macOS.
Before you begin
Insteadof File Sharing, consider using iCloud Drive, Handoff, or AirDrop to keep your documents up to date across all your devices.
iCloud Drive lets you securely access all of your documents from your iPhone, iPad, iPod touch, Mac, or PC. No matter which device you’re using,
you'll always have the most up to date documents when you need them.
With Handoff, you can start a document, email, or message on one device and pick up where you left off from another device. Handoff works
with Apple apps such as Mail, Safari, Maps, Messages, Reminders, Calendar, Contacts, Pages, Numbers, and Keynote. Some third-party apps are also compatible.
AirDrop lets you share photos, videos, websites, locations, and more with other nearby Apple devices.
What you need for File Sharing
The latest version of iTunes.The latest version of macOS or an up-to-date version of Windows 7 or later.
An iPhone, iPad, or iPod touch with the latest version of iOS.
An iOS app that works with File Sharing.
See which of your iOS apps can share files with your computer
Open iTunes on your Mac or PC.Connect your iPhone, iPad, or iPod touch to your computer using the USB cable that came with your device.
Click your device in iTunes. Get help if you can't find it.
In the left sidebar, click Apps. Then, scroll to the File Sharing section at the bottom of the page.
Select an app to see which files are available for sharing in that app on your device. If you don't see a File Sharing section, your device has no file-sharing apps.
Copy files from your computer to your iOS app
In iTunes, select the app from the list in the File Sharing section.Drag and drop files from a folder or window onto the Documents list to copy them to your device.
You can also click Add in the Documents list in iTunes, find the file or files you want to copy from your computer, and then click Add. iTunes copies these files to the app on your device. Choose only files that will work with the app. Check the app's user
guide to learn which kinds of files will work.
Copy files from an iOS app to your computer
In iTunes, select the app from the list in the File Sharing section.Drag and drop files from the Documents list to a folder or window on your computer to copy them to your computer.
You can also select the file or files that you want to copy to your computer from the Documents list and click "Save to," then find the folder on your computer to which you want to copy the files and click Save To.
Open shared files
On your iOS device, you can open the files from your computer with the app that you chose for File Sharing.You can't access these files from other apps or locations on your device. You can see the list of files in the File Sharing section
of iTunes when your device is connected to your computer.
Back up shared files
When iCloud (or iTunes) backs up your device, it backs up your shared files as well. If
you delete an app with shared files from your iOS device, you also delete those shared files from your device and your iCloud or iTunes backup. To avoid losing shared files, copy
the files to your computer before deleting the app from your iOS device.
Delete a shared file from your iOS device
To delete a file you copied to an iOS app using File Sharing, follow these steps:Open iTunes on your Mac or PC.
Connect your iPhone, iPad, or iPod touch to your computer using the USB cable that came with your device.
Select your device in iTunes. Get help if you can't find it.
In the left sidebar, click Apps. Then, scroll to the File Sharing section.
Select the app with the file that you want to delete.
Select the file that you want to delete in the Documents list, then press the Delete key on your keyboard.
When iTunes asks you to confirm, click Delete.
There might be other ways to delete files from an app. Read your app's user guide to find out more.
Published Date: Sep 22, 2016
相关文章推荐
- ios phoneGap的安装及使用
- ios10.2真机调试包,ios升级10.2后需要添加
- ios8 ios9 ios10 关于XIB中cell与cell之间总有一条线的问题
- 第35篇 IOS-WebRTC BUG处理(三)之问题图片导入及本地运行两个nodejs
- (原创)iOS tableview系统左滑删除 左滑置顶 自定义左滑事件功能 输入框弹出
- [Wondgirl] iOS-版本更新
- ios本地闹钟
- iOS事件传递及响应者关系链
- iOS 隐藏statusbar
- ios 从前台返回到回台 从后台返回到前台 或者 支付宝支付订单后 对界面进行操作
- iOS 连续多次present 之后,想回到最初的viewController
- 总结适配IOS10开发需要注意的问题
- iOS 隐藏状态栏
- iOS后台运行延长时间
- iOS--正则表达式
- RN综合演练(TabBarIOS、NavigatorIOS)
- iOS开发--iOS 实现快速切换主题详细教程(附上源码)
- [iOS] 过滤后台返回nil的数据
- iOS关于地图定位基础(一)
- 公司版苹果开发者账号注册申请流程