I'm starting a new project with SBJson parser, which people seem to recommend as the best on the internet for new iOS projects. I'm having a really strage issue which is that the current methods Stig Brautaset claims you can use on the current release (3.1), seem to be deprecated, or at least thats what my compiler is saying. I cant seem to get either to work:
NSDictionary *dict = [responseString JSONValue];
Which seems to be the most current way to do this or:
NSDictionary *dict = [parser objectWithString:responseString error:&error];
Where parser is a sbjson parser. XCode highlights both of these functions and tells me they are deprecated.
What am I doing wrong here??
Looking at the source code here and here it looks that both
- (id)objectWithString:(NSString*)jsonText error:(NSError**)error
and
- (id)JSONValue;
are deprecated since version 3.2 and it will be removed in version 4.0. Are you sure you are using the 3.1?
On the other hand both
- (id)objectWithString:(NSString *)repr;
and
- (id)objectWithData:(NSData*)data;
look available and not deprecated.
I would suggest you to use them instead.
An alternative is to use the NSJSONSerialization class provided by Apple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With