从 PC 上的 iPhone 应用程序的文档文件夹中下载创建的文件
我创建了一些文件,在我的 iPhone 应用程序中存储一些日志信息。它们存储在应用程序的文档文件夹中。我想将它们下载到我的 Mac 上。我可以在 xCode 管理器中看到它们,但无法访问这些文件。我怎样才能实现这个目标?
I created some files which store some logging information in my iPhone App. They are stored in the App's document folder. I would like to download them onto my Mac. I'm able to see them in the xCode organizer but I'm not able to access these files. How can I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,在项目的设置 plist 上设置

应用程序支持 iTunes 文件共享
。它也可以命名为UIFileSharingEnabled
。然后,对于代码,将文件保存在
NSDocumentDirectory
中,如下所示:摘自 iOS 开发技巧 - 从 App 到 iTunes 的文件共享太简单了
First, set

Application supports iTunes file sharing
on on your project's settings plist. It could also be namedUIFileSharingEnabled
.Then, for the code, save the file in
NSDocumentDirectory
like so:All taken from iOS Dev Tips - File Sharing from App to iTunes is too easy
使用管理器中的“下载”按钮可将
.xcappdata
包保存到您的 Mac (Xcode 4.2,以前的版本只保存一个文件夹)。您可以右键单击并选择“显示包内容”,将打开一个 Finder 窗口,您可以在其中找到 Documents 目录的副本。Using the Download button in the Organizer allows you to save a
.xcappdata
package to your Mac (Xcode 4.2, previous versions just save a folder). You can right-click and choose "Show Package Contents", a Finder window will open and you can find a copy of the Documents directory therein.