Domanda

{ 
ErrorCodes = ( 
   12 
); 
Success=0; 
}

I have json response like above and i am want to fetch 12 from error code so that i can display appropriate error message. I am doing like this

NSInteger err = [[dict objectForKey:@"ErrorCodes"] integerValue]; 

but this is giving exception error like

[__NSArrayM integerValue]: unrecognized selector sent to instance

what am i doing wrong? and how can i convert error code 12 into NSInteger...

È stato utile?

Soluzione

ErrorCodes here is an array, and that is the reason you got the error. You should try something like this instead:

[[[dict objectForKey:@"ErrorCodes"] objectAtIndex:0] integerValue];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top