簡體   English   中英

moveItemAtPath可在iPad上使用,但不能在Simulator上使用?

[英]moveItemAtPath works on iPad, but not on Simulator?

我正在使用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.)

謝謝,

//斯科特

Mac上的文件系統通常不區分大小寫,而設備上的文件系統則區分大小寫。 因此,在設備上,“ foo.PDF”和“ foo.pdf”是兩個不同的文件,而在模擬器使用的Mac的文件系統上,它們是相同的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM