문제

{ 
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...

도움이 되었습니까?

해결책

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];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top