json NSNumber unrecognized selector sent to instance

I am trying to get a Number from a json response but I keep getting error :

unrecognized selector sent to instance

Here is my code:

   NSNumber *FaultCode;
         NSArray *detailsFault = json[@"GetResponse"][@"GetResult"][@"Faults"][@"FaultException"];

        for (NSDictionary *fault in detailsFault){
            NSLog(@"%@", fault[@"Code"]);
            FaultCode = fault[@"Code"];

It works fine for Strings but for the other data but it fails when trying to use on this which is just a number.

Here is the json:

{ "GetResponse":{ "GetResult":{ "Faults":{ "FaultException":{ "Code":1234, "Message":"It has failed" } }, "Response":null } } }

Source: json

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.