iOS8设备上的NSCOCAerorDomain 513
我正在尝试使用创建文件夹iOS8设备上的NSCOCAerorDomain 513,ios,objective-c,ios8,xcode6,nsfilemanager,Ios,Objective C,Ios8,Xcode6,Nsfilemanager,我正在尝试使用创建文件夹 BOOL status =[fileManager createDirectoryAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:pathComponent] withIntermediateDirectories:YES attributes:nil error:&error]; 在iOS7(设备和仿真器)、iOS8(仅仿真器)中,status为YES 但
BOOL status =[fileManager createDirectoryAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:pathComponent] withIntermediateDirectories:YES attributes:nil error:&error];
在iOS7(设备和仿真器)、iOS8(仅仿真器)中,status
为YES
但在iOS 8设备中,状态为NO
&错误描述=操作无法完成。不允许操作
[[NSBundle mainBundle]resourcePath]stringByAppendingPathComponent:pathComponent的值
在iOS 7中
/var/mobile/Applications/7AC7128C-1926-41AC-9108-4C85D0D75AE9/HelloWorld.app/../Library/Pages/CSS
在iOS 8中
/private/var/mobile/Containers/Bundle/Application/1E2D5D54-2585-4CB9-BD00-24C4BF873421/HelloWorld.app/../Library/Pages/CSS
为什么我获取的操作无法完成
仅在iOS8设备中出错?该代码在所有版本的iOS上都会失败,因为您无法在应用程序包中创建文件/目录
您需要在应用程序文档、缓存等目录中创建文件。但它在iOS 8之前的所有其他设备上都能正常工作。@TaruniNeema这是一种未定义的行为,因为一旦安装应用程序包,就不应弄乱它。