iOS8.4 和 Xcode6.4,
注意: 数据库路径:/Library/Developer/CoreSimulator/Devices/FD6CE853-5AE2-48DA-A9B1-E69A6BB4F9F8/data/Containers/Data/Application/BED214A4-65E1-4BD8-9908-29E07FD47EBA/Documents/DB/copybox.db
节省时间文件路径:/Library/Developer/CoreSimulator/Devices/FD6CE853-5AE2-48DA-A9B1-E69A6BB4F9F8/data/Containers/Data/Application/BED214A4-65E1-4BD8-9908-29E07FD47EBA/Documents/Images/010521PMThursdayAug2015.png
我想从文档目录加载图像。我尝试了多种方法,如下所示。
NSString*path = [info valueForKey:@"copied_img_path"];
path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
path = [NSString stringWithFormat:@"file:/%@",path];//
NSLog(@"\n##IMAGE PATH##:-%@\n",path);
//Tried with this
[imageview setImageWithURL:[NSURL fileURLWithPath:path]];
//Tried with this
NSURL* pathurl = [NSURL URLWithString:path];
[imageview setImageURL:pathurl];
//Tried with this
UIImage* image = [UIImage imageWithContentsOfFile:path];
[imageview setImage: image];
但没有成功。
然后我在文档目录中保存图像时检查文件路径。没关系。但是下次我运行此代码时,当前的应用程序文件夹会消失。所以,在 iOS8.3+ 中访问文档目录有任何变化,或者我犯了任何错误。请告诉我。
提前致谢