我正在尝试将.txt文件的内容写入字符串,而不是获取(null)。有什么想法吗?
NSURL *desktopURL = [[NSFileManager defaultManager] URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
NSURL *shortcutURL = [desktopURL URLByAppendingPathComponent:@"note.txt"];
NSString *content = [[NSString alloc]initWithContentsOfURL:shortcutURL encoding:NSUTF8StringEncoding error:nil];
NSLog(@"%@", content);
谢谢!