Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS8设备上的NSCOCAerorDomain 513_Ios_Objective C_Ios8_Xcode6_Nsfilemanager - Fatal编程技术网

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这是一种未定义的行为,因为一旦安装应用程序包,就不应弄乱它。