Search code examples
objective-cmacosjsonkit

EXC_BAD_ACCESS from JSONKit


I keep running into EXC_BAD_ACCESS when calling [obj JSONString] method in the following code and I don't know why. I have tried turning on Zombie Objects but nothing different happens.

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    NSDictionary *obj = @{
        @"id": @1,
        @"date": @"11/07/2012",
        @"companyInfo": @"Company Details",
        @"customerInfo": @"Customer Details",
        @"taxRate": @0
    };
    NSLog(@"%@", obj);
    NSLog(@"%@", [obj JSONString]);

    // Other stuff here
}

I am running Lion. I have just upgraded to Xcode 4.4 and am using CocoaPods 0.9.2 to install JSONKit. I have tried both the 1.4 and 1.5pre versions of JSONKit to no avail.

I am using the latest OS X SDK (10.8) with a deployment target of 10.6 (it must deploy to 10.6). I have also tried the 10.7 SDK but the results are the same. The 10.6 SDK is no longer available so I cannot test that.

clang --version shows:

Apple clang version 3.1 (tags/Apple/clang-318.0.61) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

The application compiled and ran correctly when I was using Xcode 4.3.


Solution

  • It turned out that the problem was that CocoaPods does not remove the existing JSONKit files when running pod install. I'm using version 1.5pre and the code executes correctly.