指定パスのファイルを読み込むことが出来ません。
swift
1 let destinationPath = "/Users/user/Documents/test.plist" 2 let filemgr = NSFileManager.defaultManager() 3 if filemgr.fileExistsAtPath(destinationPath) { 4 print("File exists") 5 do { 6 let readFile = try String(contentsOfFile: destinationPath, encoding: NSUTF8StringEncoding) 7 print("\(readFile)") 8 } catch let error as NSError { 9 print("Error: \(error)") 10 } 11 }
ログには以下のような表示が出ています。
File exists Error: Error Domain=NSCocoaErrorDomain Code=257 "The file “test.plist” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/Users/user/Documents/test.plist, NSUnderlyingError=0x7fdc5bc467f0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
調べても出てこないのでこまっています。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/06/25 15:52
2016/06/25 17:16