iOS:APP获取文件路径

获取资源路径 使用[NSBundle MainBundle] pathForResources 拿不到 images.xcassets里面图片的路径

#define ResourcePath(name,type) [[NSBundle mainBundle] pathForResource:name ofType:type]

Cache目录路径

#define CachePath(_arg) [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:_arg]

Libaray目录路径

#define LibararyPath(_arg) [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:_arg]

Document目录路径

#define DocumentPath(_arg) [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:_arg]

猜你喜欢

转载自blog.csdn.net/qq_15289761/article/details/106828480