如何使用 UIFileSharingEnabled 共享/Documents 中的某个目录树列表
我想将 itunes 文件共享集成到我的应用程序中。我知道我只需要在 info.plist 中设置 true UIFileSharingEnabled 。但它使我的应用程序中的 /Documents 中的所有文件和目录都显示在 itunes 文件共享中。我只想在 itunes 文件共享中共享一个目录树列表。
这是我的 /Documents 的屏幕截图(我从 iphone 模拟器目录中获取它,但它对于设备来说是相同的)
从这些图片中,我只想共享项目目录中的所有文件,而不显示项目目录本身。
我可以这样做吗?请帮我解决这个问题。
谢谢你,里斯玛
i want to integrate itunes file sharing into my app. I know that i just need to set true UIFileSharingEnabled in info.plist. But it make all files and directories in /Documents from my app is show in itunes file sharing. I just want to share a directory tree listing in itunes file sharing.
This is a screenshoot of my /Documents (i got it from iphone simulator directory but it is same for the device)
from that pictures, i just want to share the all files in Project directory without showing Project directory itself.
Can i do that? Please help me to solve this.
Thank you, Risma
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为当您使用
Info.plist
中的UIFileSharingEnabled
键启用文件共享时,您无法更改共享内容。不过,我建议您修改内容,以便应用程序特定内容进入
Library
文件夹,例如数据库文件和其他非用户内容。您可能需要浏览this
用于识别 iTunes 备份的文件夹。I don't think you can alter what is shared when you enable file sharing by using the
UIFileSharingEnabled
key inInfo.plist
.However I suggest that you revamp your content so that application specific content go into the
Library
folder such as the database file and other non-user stuff. You might want to go throughthis
for identifying which folders are backed up by iTunes.符号链接怎么样?如果您可以实现它们并控制权限,那么这将立即解决该问题。不知道如何在 iOS 上做到这一点,但这绝对值得研究。当谈到文件共享时,链接是您最好的朋友。
我没有任何 iPhone 应用程序开发经验,但我在 Linux 中完成了大量文件共享管理。希望不会有太大不同...但我不知道 iPhone 可以使用哪些系统调用。如果你知道的话,我很乐意知道。祝你好运!
How about a symbolic link? That would solve that issue in a snap, provided you can implement them and control permissions. Not sure how to do that with iOS, but it's definitely worth looking into. When it comes to file sharing, links are your best friend.
I don't have any experience with iPhone app dev, but I've done plenty of file share management in Linux. Hopefully it's not too different... But I have no idea what system calls are available to you with iPhones. If you find out, I'd enjoy knowing. Good luck!