返回錯誤結果當我嘗試使用代碼波紋管其誤差不返回到創建一個文件夾,當我試圖創建一個已經存在的,而不是返回是一個文件夾:的NSFileManager的方法createDirectoryAtPath iOS上
[[NSFileManager defaultManager] createDirectoryAtPath:[documentsPath stringByAppendingPathComponent:@"temp"] withIntermediateDirectories:NO attributes:nil error:&error];
蘋果documentation說:
Return Value
YES if the directory was created or already exists or NO if an error occurred.
所以我應該得到是成功或者文件夾是否存在。但是,當文件夾存在我得到這個消息:
Error Domain=NSCocoaErrorDomain Code=516 "The operation couldn’t be completed. (Cocoa error 516.)" UserInfo=0x200ef5f0 {NSFilePath=/var/mobile/Applications/DA657A0E-785D-49B4-9258-DF9EBAC5D52A/Documents/temp, NSUnderlyingError=0x200ef590 "The operation couldn’t be completed. File exists"}
這是一個錯誤,應當報蘋果還是我做錯了什麼?
@trojanfoe:我確定。我已經重新安裝了應用程序。第一次創建「temp」文件夾,但所有後續嘗試都會給我帶來錯誤。 – 2013-03-06 10:52:26