estoy tratando de obtener una matriz dentro de un NSMutableDictionary que tiene este aspecto:IOS obtiene una matriz dentro de NS (mutable) Diccionario
{
coments = (
);
"foto_user" = "<null>";
fotos = (
{
fecha = "2012-08-31 19:44:31";
id = 4926;
nombre = "image5773.jpg";
posicion = 0;
ruta = "img/";
tipo = 1;
},
{
fecha = "2012-08-31 19:44:31";
id = 4927;
nombre = "image1779.jpg";
posicion = 0;
ruta = "img/";
tipo = 1;
},
{
fecha = "2012-08-31 19:44:31";
id = 4928;
nombre = "image5938.jpg";
posicion = 0;
ruta = "img/";
tipo = 1;
},
{
fecha = "2012-08-31 19:44:32";
id = 4929;
nombre = "image4424.jpg";
posicion = 0;
ruta = "img/";
tipo = 1;
}
);
"have_coments" = 0;
id = 40505;
"id_lugar" = "<null>";
"id_pais" = 28;
"id_user" = "<null>";
iso = fr;
link = "<null>";
lugar = Paris;
"nombre_pais" = "France";
root = "http://www.domain.com/";
tags = (
);
titulo = "Sunset";
"url_share" = "http://www.friktrip.com/experiencia/40505";
videos = (
);
}
Y estoy utilizando este código:
//Get data from dictionary
NSMutableArray *foto = [[NSMutableArray alloc]init];
foto = [OnlineObjects objectAtIndex:1];
Pero la matriz "fotoarray" permanece vacía tratando de obtener la información de NSMutableArray.
//Get only the nombre Key of the NSMutableArray
NSArray *fotoarray = [foto valueForKey:@"nombre"];
¿Cuál es la manera de hacer una matriz con todos los objetos con el nombre de clave "nombre"?
1) Lo que has publicado no es una matriz mutable, es un 'NSDictionary'. 2) ¿Qué es 'OnlineObjects'? – Alladinian