이것은 내가 가지고있는 코드입니다. NSDictionary는 이전에는 사용되어 왔지만 문제를 찾으려고 할 때 일시적으로 제거했습니다.writeToPath : 원자 적으로 : 이것이 실패한 이유를 모르겠 음
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Entries/"];
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isDirectory = NO;
BOOL directoryExists = [fileManager fileExistsAtPath:path isDirectory:&isDirectory];
if (!directoryExists) {
[fileManager createDirectoryAtPath:path withIntermediateDirectories:NO attributes:nil error:nil];
}
if ([self.pathName isEqualToString:@""] || self.pathName == nil) {
self.pathName = [NSString stringWithFormat:@"%@.JEntry", [JMedia generateUuidString]];
}
NSString *entryPath = [path stringByAppendingPathComponent:self.pathName];
NSDictionary *dictionary;
NSLog(@"entrypath: %@", entryPath);
BOOL success = [dictionary writeToFile:entryPath atomically:YES];
NSLog(@"success: %i", success);
NSLog :
entrypath: /var/mobile/Applications/1B838285-8326-427A-8AC5-0D5567C3CD81/Documents/Entries/70AFCF6D-540E-436E-9989-68793500E35B.JEntry
success: 0
시뮬레이션 파일의 디렉토리가 파일이 있는지 확인 했습니까? – CodaFi
'[JMedia generate UuidString]'메소드는 완전히 임의의 문자열을 반환하므로 이미 존재할 수 없습니다. – Andrew
'dictionary'는 무효이므로, 결코 작동하지 않을 것입니다. – jrturton