【问题标题】:moveItemAtPath works on iPad, but not on Simulator?moveItemAtPath 适用于 iPad,但不适用于模拟器?
【发布时间】:2011-03-03 02:23:16
【问题描述】:

我正在使用 moveItemAtPath 调用将文件扩展名从 .PDF 更改为 .pdf(只是小写)。它在模拟器上失败,如下所示,但在设备上工作正常。会不会是某种权限问题?

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.)

谢谢,

//斯科特

【问题讨论】:

    标签: iphone ipad ios-simulator


    【解决方案1】:

    Mac 上的文件系统通常不区分大小写,而设备上的文件系统则区分大小写。所以在设备上,“foo.PDF”和“foo.pdf”是两个不同的文件,而在模拟器使用的Mac文件系统上它们是相同的。

    【讨论】:

    • 你的异常快!谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-17
    • 2012-11-01
    • 2011-03-08
    相关资源
    最近更新 更多