将.txt文件组件附加到URL路径不起作用:
@H_502_20@var error:NSError? let manager = NSFileManager.defaultManager() let docURL = manager.URLForDirectory(.DocumentDirectory,inDomain:.UserDomainMask,appropriateForURL:nil,create:true,error:&error) docURL.URLByAppendingPathComponent("/RicFile.txt") <-- doesn't work
通过调试器:
file:///Users/Ric/Library/Developer/CoreSimulator/Devices/ <device id>/data/Containers/Data/Application/<app id>/Documents/
原因(通过错误):
“The operation couldn’t be completed. Is a directory”
所以问题:为什么以下不起作用?
docURL.URLByAppendingPathComponent("/RicFile.txt")