如何从iPad开发工具应用程序中检索文件? [英] How can I retrieve files from an iPad development tool app?

查看:144
本文介绍了如何从iPad开发工具应用程序中检索文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定如何最好地标出这个标题,所以如果有人可以推荐更好的标题,请随时编辑。

I'm not sure how best to word the Title of this, so if someone can suggest a better one, please feel free to edit.

我是为iPad编写一个应用程序,需要我在开发过程中使用iPad自己创建一些应用程序数据文件,即我用iPad构建的工具将由开发人员自己用来创建可以由应用程序播放的示例文件本身。

I'm writing an app for iPad that requires me to create some of the app data files with the iPad itself during development, i.e. a tool I am building with the iPad will be used by the developers themselves to create sample files that can be played by the app itself.

我的问题是,我怎样才能做到最好?当我连接iPad时,我尝试将文件写入我的Mac上的本地目录,但是我遇到了崩溃。理想情况下,如果有一些方法让我在我的iPad上生成输出文件并在我的开发版运行时将其传输到我的Mac,我会这样做。

My question is, how can I best do this? I tried writing files to a local dir on my mac while the iPad was connected but I get a crash. Ideally if there is some way for me to generate an output file on my iPad and get it transferred to my Mac while my dev build is running, I'd do that.

建议?

推荐答案

使用Apple的文件共享将文件放入可通过iTunes访问的文件夹中的技巧看起来很简单这里:

It looks like the trick it to use Apple's File Sharing to place files in a folder accessible through iTunes, explained here:

标准应用程序行为

要点是将UIFileSharingEnabled plist键设置为true,然后查询应用程序的Documents文件夹,如下所示:

The gist is to add a UIFileSharingEnabled plist key set to true and then query the Documents folder for your application like so:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

这篇关于如何从iPad开发工具应用程序中检索文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆