我在下面有这段代码:
NSString *fileName = [[NSUserDefaults standardUserDefaults] objectForKey:@"recentDownload"];
NSString *fullPath = [NSBundle pathForResource:fileName ofType:@"txt" inDirectory:[NSHomeDirectory() stringByAppendingString:@"/Documents/"]];
NSError *error = nil;
[textViewerDownload setText:[NSString stringWithContentsOfFile:fullPath encoding: NSUTF8StringEncoding error:&error]];
textviewerdownload
是textview
显示文件中的文本。实际文件名存储在NSUserDefault
名为recentDownload
.当我构建它时,我单击
button
它下面的那个,以及我的应用程序crashes
。语法有什么问题还是只是简单的错误?