如何获取应用程序文档目录iPhone的URL [英] How to get URL for application's document directory iPhone

查看:74
本文介绍了如何获取应用程序文档目录iPhone的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码是核心数据的一部分. URLsForDirectory ....方法无法在iOS<上运行4,所以我需要知道其他一些要调用的方法/对象.我还将申请文档以供将来参考.谢谢

This code is a part of Core Data. The URLsForDirectory....method does not run on iOS < 4 so I need to know some other methods/objects to call. I would also appriciate documentation for future reference. Thank you

/**
 Returns the URL to the application's Documents directory.
*/
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}

推荐答案

您可以通过NSSearchPathForDirectoriesInDomains 这将在iOS 2+上运行.

This will work on iOS 2+.

这篇关于如何获取应用程序文档目录iPhone的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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