NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"file.txt"];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:path] == NO) { // 파일 존재 유무 확인
if ([fileManager createFileAtPath:path contents:nil attributes:nil] == NO) { // 파일 생성 성공 여부 확인
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Fail" message:@"File Create Failed" delegate:self cancelButtonTitle:@"Comfirm" otherButtonTitles:nil];
[alert show];
[alert release];
return ;
}
}