How can I retrieve files from an iPad development tool app?

只愿长相守 提交于 2020-01-17 08:00:38

问题


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.

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.

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.

Suggestions?


回答1:


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

Standard Application Behaviors

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];


来源:https://stackoverflow.com/questions/3995066/how-can-i-retrieve-files-from-an-ipad-development-tool-app

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