У меня возникли проблемы с определением наличия файла в папке с документами. Даже если я не сохранил данные в файле с NSKeyedArchiver, мой тест вернет true. Тест:iPhone - сохранение и извлечение данных
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *documentPath = [documentsDirectory stringByAppendingPathComponent:@"gameData.dat"];
if ([fileManager fileExistsAtPath:documentPath]) {
//if the file exists retrieve the data.
//this is always called, even if there is no file at the documentPath.
}else{
//set the defaults and save data.
}
один раз прозрачный документPath с симулятора .. – ajay