来自JSONKit的EXC_BAD_ACCESS

时间:2012-07-28 02:45:07

标签: objective-c macos jsonkit

在以下代码中调用[obj JSONString]方法时,我一直在运行EXC_BAD_ACCESS,我不知道为什么。我试过打开Zombie Objects,但没有任何不同的事情发生。

- (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
}

我在经营狮子。我刚刚升级到Xcode 4.4并使用CocoaPods 0.9.2来安装JSONKit。我已经尝试过JSONKit的1.41.5pre版本都无济于事。

我正在使用最新的OS X SDK(10.8),部署目标为10.6(必须部署到10.6)。我也尝试了10.7 SDK但结果是一样的。 10.6 SDK不再可用,所以我无法测试。

clang --version显示:

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

当我使用Xcode 4.3时,应用程序已正确编译并运行。

1 个答案:

答案 0 :(得分:0)

原来,问题是CocoaPods在运行pod install时没有删除现有的JSONKit文件。我正在使用版本1.5pre并且代码正确执行。