私はアプリケーションが初期化された後にファイルを追加したいアプリケーションの中にプリロードされたフォルダを持っているので、NSApplicationSupportDirectoryにファイルを保存しようとしています。私はNSLogファイルの内容をしようとしているので、実際に働いているかどうかを確認することができます。デバッガから、私はコンテンツがあることを知ることができます。これは私が意味するものではありません。誰ですか?NSApplicationSupportDirectoryが無効です。CFStringRef
NSString *document = [NSString stringWithFormat:@"%@ %@ %@ %@ %@", description, focus, level, equipment, waterDepth];
//NSLog(@"%@", document);
//get the documents directory:
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *supportDirectory = [paths objectAtIndex:0];
//filename
NSString *filename = [NSString stringWithFormat:@"%@/%@", supportDirectory,[_nameTextField.text stringByAppendingString:@".txt"]];
NSLog(@"%@", supportDirectory);
NSLog(@"%@", filename);
[document writeToFile:filename atomically:NO encoding:NSStringEncodingConversionAllowLossy error:nil];
NSString *content = [[NSString alloc]initWithContentsOfFile:filename usedEncoding:nil error:nil];
NSLog(@"%@", content);
名:の/ var /モバイル/アプリケーション/ 5461D615-8F57-4BBB-AEB8-482B4BF3BA36 /ライブラリ/ Application Support/test.txtの –
コンテンツ:(ヌル)エラーのNSLogで –
アプリケーションがクラッシュ:EXC_BAD_ACCESS(コード= 1 、adderss = 0x104) –