Skip to content

FrequentlyAskedQuestions

stig edited this page Mar 31, 2012 · 7 revisions

Frequently Asked Questions

It depends on the question, but the mailing list is probably your best bet. I am not always available and the group has a lot of knowledgeable people that might be able to answer in my place.

In the issue tracker. If you provide a patch, or a test, or a good use case, it's much more likely to be fixed/implemented in a timely manner.

The full error is something like this:

Dyld Error Message:
  Library not loaded: @loader_path/../Frameworks/JSON.framework/Versions/A/JSON
  Referenced from: /Users/santthosh/Library/Application Support/iPhone
Simulator/User/Applications/FC6355D7-960A-4E5F-8003-AA36B561C260/HelloNavigation.app/HelloNavigation
  Reason: image not found

I'm guessing this is this on an iOS device. Dynamic libraries are not supported on iOS. You must link to the libjson target or include the code for the framework directly in your application.

Are you sure it's legal JSON? This framework is really strict, so won't accept stuff that (apparently) several validators accepts. In particular, literal TAB, NEWLINE or CARRIAGE RETURN (and all other control characters) characters in string tokens are disallowed, but can be very difficult to spot. (These characters are allowed between tokens, of course.)

If you get something like the below (the number may vary) then one of your strings has disallowed Unicode control characters in it.

  NSLocalizedDescription = "Unescaped control character '0x9'";

To help you figure out what the error is you may find it handy to use the errorTrace method:

  SBJsonParser *parser = [SBJsonParser new];
  id object = [parser objectWithString:jsonString];
  if (!object)
      NSLog(@"Error trace: %@", parser.errorTrace);

You're in luck. For versions 2.2 and above the error trace will automatically be printed to the Console log.

You should only encounter this error if you're linking to the static library rather than including the source directly.

The new (3.0) linker apparently has a bug that causes -ObjC to not be processed correctly on device builds. If you have a category in a static library--and try to reference a method in that category--it will work on the simulator but crash on the device.

The solution is to include the linker flag -all_load in addition to -ObjC. If that is not an option, you could try to use the SBJsonParser or SBJsonWriter objects directly rather than the category methods.

(Thanks to Greg Pasquariello)

Yes! These are all tutorials provided by third-party people:

Yes! This is how I use it. Recent versions of Xcode (4.2 and above) have made this much simpler, however this has changed so many times that I do no longer try to document how to do it. Please read the Xcode documentation for your particular version of Xcode for how to do this.

It was removed in version 2.3 because it was a nightmare to support. Sorry.

Probably not. I focus on creating a strict framework. There are, however, several forks that add various features. Maybe one of them adds the feature you want?

See the JSON framework network for a list of such forks.

Yes, there are. TouchJSON, part of TouchCode is a popular alternative. There's also Yet Another JSON Library which can be used in Objective-C apps.

There's a new kid on the block that promises to be very fast: JSONKit.

Starting in Mac OS X 10.7 and iOS 5, JSON support has been added into Foundation with the NSJSONSerialization class.