来自JSONKit的EXC_BAD_ACCESS
问题描述:
在下面的代码中调用[obj JSONString]
方法时,我不断遇到EXC_BAD_ACCESS,我不知道为什么。我试过打开僵尸对象,但没有发生任何不同。来自JSONKit的EXC_BAD_ACCESS
- (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。我试过1.4
和1.5pre
版本的JSONKit都无济于事。
我正在使用最新的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时正确运行。
答
事实证明,问题是CocoaPods在运行pod install
时没有删除现有的JSONKit文件。我正在使用版本1.5pre
并且代码正确执行。