CoreData: ¿almacenar imágenes en DB o no?
Estoy creando una aplicación que toma fotos del sitio web para algún Nombre de usuario y la muestra en una UITable con nombre de usuario, luego, al hacer clic en el nombre de usuario, muestra las fotos de este usuario y luego al hacer clic en el nombre de la foto, se muestra la foto a pantalla completa.
Mi pregunta es que estoy usando NSData para obtener fotos de internet. ¿Tengo que guardar los datos en CoreData? Al presionar el nombre del usuario, crea NSData y descarga fotos de Internet y las muestra en UITable. Y lleva tiempo.
¿Qué es un buen enfoque? y ¿Cómo puedo guardar estas imágenes en CoreData?
Estoy usando este metodo
NSData *imageData=[flickr dataForPhotoID:firstPhoto.id fromFarm:firstPhoto.farm
onServer:firstPhoto.server withSecret:firstPhoto.secret inFormat:
FlickrFetcherPhotoFormatSquare];
y aquí la definición del método dataForPhotoID
- (NSData *)dataForPhotoID:(NSString *)photoID fromFarm:(NSString *)farm
onServer:(NSString *)server withSecret:(NSString *)secret
inFormat:(FlickrFetcherPhotoFormat)format {
#if TEST_HIGH_NETWORK_LATENCY
sleep(1);
#endif
NSString *formatString;
switch (format) {
case FlickrFetcherPhotoFormatSquare: formatString = @"s"; break;
case FlickrFetcherPhotoFormatLarge: formatString = @"b"; break;
}
NSString *photoURLString = [NSString stringWithFormat:@"http://farm%@.static.flickr.com/%@/%@_%@_%@.jpg", farm, server, photoID, secret, formatString];
NSURL *url = [NSURL URLWithString:photoURLString];
return [NSData dataWithContentsOfURL:url];
}