简体   繁体   English

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

[英]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.

相关问题 SQLite Code在iPhone模拟器上运行,在iPad上崩溃 - SQLite Code works on iPhone simulator, crashes on iPad 模拟器iPad Pro(适用)与iPhone 6 Plus - Simulator IPad pro (works) vs iPhone 6 plus free()调用适用于模拟器,让iPad生气。 iPad粉碎 - free() call works on simulator, makes iPad angry. iPad smash 应用程序可在iPhone上运行,但在iPad模拟器上崩溃,并停留在ipad上的启动图像上 - App works on iPhone but crash on iPad simulator stuck with launch image on ipad Codename One应用程序适用于模拟器和Android,但在iPad和iphone上崩溃 - Codename One application works on simulator and Android but crashes on iPad and iphones iOS 8.3 iPad上的自定义UIWindow可在模拟器上运行,但不能在设备上运行 - Custom UIWindow on iOS 8.3 iPad works on simulator but not device 应用程序在iPhone / iPod上运行良好,但在iPad(甚至模拟器)上崩溃 - App works fine on iPhone/ iPod but crashes on iPad (even simulator) 带有iOS 9.3的XCode 7-约束在iPhone模拟器中有效,但在iPad模拟器中运行时会添加边距 - XCode 7 with iOS 9.3 - Constraints Works in iPhones Simulator But When Running in an iPad Simulator a Margin is Added 将视频添加到iPad模拟器 - Adding Video to iPad Simulator Ipad Simulator无法自动旋转 - Ipad Simulator not auto rotating
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM