私は以下のコードを持っています:
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
これの下にある と my applicationをクリックしますcrashes
。構文に何か問題がありますか、それとも単純なエラーですか?