I have found an API that returns a JSON encoded string of data that returns the actual number or the "zero" value Gives in form. As long as JSON has a numerical or string value, everything works as expected, if the key: value pair value is zero, then the code crashes down.
How do I test NSDictionary objectForKey when I am getting a tap from SBJSon? When the API returns file to the file type , the code below will crash if () on the line. My purpose - C code tries to test for expected values: API JSON output: Code> Tasks {filename = "&" Lt; null & gt; "; Filetype = "& lt; null & gt;"; Tclid = 3; } When the data from JSON is transferred to the cocoa collection, the class represents Used to do "no value", because the cocoa archive can not contain empty slots To test for it, you You are getting the accident because you are sending
if (1 == [[Value of WorkForKey: @ "filetype"] integerValue] } {// do something} other {// do something else}
NSOl () is the output of NSDictionary: < / P>
& lt; Null & gt; How
NSNull prints out
someObject == [NSNull null] . This is a singleton - only one example of code
NSNull - indicator comparison works, although you may prefer to follow the normal Coco Comparison Conferences and use the
[someObject isKindOfClass Want to: [NSNull class]]] .
integerValue to that
NSNull object
NSNull
integer value does not answer and raises an exception.
Comments
Post a Comment