I have a data from API Rest. I convert it to a NSArray
with serialization and convert this to Dictionary. But I can't access to the pairs values (below).
My first step:
NSArray *arrayDiccionario = [NSJSONSerialization JSONObjectWithData:data _ options:NSJSONReadingMutableContainers error:&errorSerializacion];
My second step:
NSMutableArray *arrayMisObjetos = [NSMutableArray new];
My thrid step:
for(NSDictionary *diccionario in arrayDiccionario) { _eventId = [ [ diccionario objectForKey:@"id" ] intValue ]; _nameEvent = [ diccionario objectForKey:@"nameEvent" ]; }
In this step I have an exception.
diccionario have 0 elements and I don´t have access to any object with Keys
What's wrong?
Sorry for my english.
---- arrayDiccionario Information ----
--------------------------------------
[0] (null) @"listEvents" : @"10 elements"
key __NSCFString * @"listEvents"
value __NSArrayM * @"10 elements"
[0] __NSDictionaryM * 2 key/value pairs
[0] (null) @"id" : (long)65
[1] (null) @"nameEvent" : @"Open Malaga"
[1] __NSDictionaryM * 2 key/value pairs
[2] __NSDictionaryM * 2 key/value pairs
[3] __NSDictionaryM * 2 key/value pairs
[4] __NSDictionaryM * 2 key/value pairs
[5] __NSDictionaryM * 2 key/value pairs
[6] __NSDictionaryM * 2 key/value pairs
[7] __NSDictionaryM * 2 key/value pairs
[8] __NSDictionaryM * 2 key/value pairs
[9] __NSDictionaryM * 2 key/value pairs