[英]moveItemAtPath works on iPad, but not on Simulator?
I am using moveItemAtPath call to change a file extension from .PDF to .pdf (just lowercasing it). 我正在使用moveItemAtPath调用将文件扩展名从.PDF更改为.pdf(只是将其小写)。 It fails on the simulator as shown below, but works fine on the device.
如下所示,它在模拟器上失败,但在设备上运行良好。 Could it be some sort of permissions problem?
可能是某种权限问题?
lowerPDF=[upperPDF stringByReplacingOccurrencesOfString:@".PDF" withString:@".pdf"];
NSLog(@"Lowercasing filename %@ to %@",upperPDF,lowerPDF);
if (![fm moveItemAtPath:upperPDF toPath:lowerPDF error:&error])
NSLog(@"RENAME error %@",[error localizedDescription]);
NextPage[13625:207] Lowercasing filename /Users/scott/Library/Application Support/iPhone Simulator/4.2/Applications/7D38A00A-3990-441C-96C5-DD56EC3B6922/Documents/What a Difference a Day made 24010812.PDF to /Users/scott/Library/Application Support/iPhone Simulator/4.2/Applications/7D38A00A-3990-441C-96C5-DD56EC3B6922/Documents/What a Difference a Day made 24010812.pdf
NextPage[13625:207] RENAME error The operation couldn’t be completed. (Cocoa error 512.)
Thanks, 谢谢,
//Scott //斯科特
The filesystem on a Mac is normally case-insensitive, while the filesystem on the device is case-sensitive. Mac上的文件系统通常不区分大小写,而设备上的文件系统则区分大小写。 So on the device, "foo.PDF" and "foo.pdf" are two different files, while on the Mac's filesystem used by the simulator they are the same.
因此,在设备上,“ foo.PDF”和“ foo.pdf”是两个不同的文件,而在模拟器使用的Mac的文件系统上,它们是相同的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.