iphone将文件夹从包复制到文档 [英] iphone copying folder from bundle to documents

查看:132
本文介绍了iphone将文件夹从包复制到文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力工作。我正在尝试将文件夹中的文件夹复制到文档目录。

I'm having the hardest time getting this to work. I'm trying to copy a folder from my bundle to the documents directory.

我要找的文件夹在这里:

the folder I'm trying to find is here:

... app / Resources / 12 /(一堆jpgs)

...app/Resources/12/(a bunch of jpgs)

NSString *myPath = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:@"12"];
NSLog(@"%@",myPath);/// returns "..../MyApp.app/12"

NSArray *arrayOf12s = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:myPath error:nil];

NSLog(@"%@",arrayOf12s);     ////always returns NULL


推荐答案

如何使用-contentsOfDirectoryAtPath中的NSError参数:错误:调用?

How about using the NSError argument in -contentsOfDirectoryAtPath:error: call?

NSString *myPath = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:@"12"];
NSLog(@"%@",myPath);/// returns "..../MyApp/12"

NSError *error = nil;
NSArray *arrayOf12s = [[NSFileManager defaultManager]contentsOfDirectoryAtPath:resourceDBFolderPath error:&error];

if (error)
   NSLog(@"Error: %@", [error localizedDescription]);

NSLog(@"%@",arrayOf12s);     ////always returns NULL

它可能会对原因有所启发......

It might shine some light on the cause...

这篇关于iphone将文件夹从包复制到文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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