JSONKit icon indicating copy to clipboard operation
JSONKit copied to clipboard

Xcode 7 Before is use JSONKit in Object but now not use JSONKit in Xcode 7

Open BadSuNian opened this issue 8 years ago • 7 comments

        NSArray * josnArry = [[NSArray alloc] init];            
        NSString * josnString = [josnArry JSONString];

Xcode 7 reported the wrong how to solve the crash

BadSuNian avatar Sep 19 '15 03:09 BadSuNian

https://github.com/jcbertin/JSONKit

use it

Gareth-swifter avatar Sep 19 '15 04:09 Gareth-swifter

I've replaced the still crash tip:

Sep 19 14:18:35 XXXX[718] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Sep 19 14:18:35 XXXX[718] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Sep 19 14:18:35 XXXX[718] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

BadSuNian avatar Sep 19 '15 06:09 BadSuNian

@BadSuNian I have same problem. I thought it was because of JSONKit, but I still have crash after applied @h532930330's patch. And then I find out that another third party library TXJSONKitSerializing defines same category method which crashes app. How I fix: I changed JSONKit's category method name to another to avoid using TXJSONKitSerializing because TXJSONKitSerializing is inside some lib.a so I can't change. Chinese comment (中文解释) 我根据上面的comment解决后,还是有问题,后来发现,在运行的时候,方法JSONString其实是调用了某个第三方库的TXJSONKitSerializing定义的方法,而不是JSONKit里的。 看样子,在运行时,第三方库的方法覆盖了源码里的同样的方法。 解决办法就是,把JSONKit里的方法加个前缀,然后代码里面使用这个加了前缀的方法,这样就不会误用到TXJSONKitSerializing里的。 这也强调了一个写Category方法的要求,尤其是提供给别人使用的第三方库的时候,一定要加上前缀,以防影响到使用者。

caisd1998 avatar Sep 22 '15 03:09 caisd1998

@caisd1998 cool,you are right. 多亏遇到你,找了好几天终于解决了,感谢分享

poorbird avatar Oct 09 '15 10:10 poorbird

@caisd1998 my email [email protected] your? Please explain in detail.

BadSuNian avatar Oct 10 '15 07:10 BadSuNian

My project crashed here :

void objectISA = (JK_EXPECT_F(workAroundMacOSXABIBreakingBug)) ? NULL : *((void *)objectPtr);

my codes are like this below: NSArray * josnArry = [[NSArray alloc] init];
NSString * josnString = [josnArry JSONString];

inside josnArry are NSDictionary(s) ! help !

loveNoodles avatar Oct 19 '15 06:10 loveNoodles

Im used "JSONKit" MAJK ?????????????? whats this?

  • thread #1: tid = 0x41774f, 0x000000010995c315 EverVCiOSClientMAJK_encode_add_atom_to_buffer + 6377, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT) frame #0: 0x000000010995c315 EverVCiOSClientMAJK_encode_add_atom_to_buffer + 6377 frame #1: 0x000000010995c6ba EverVCiOSClientMAJK_encode_add_atom_to_buffer + 7310 frame #2: 0x000000010995a554 EverVCiOSClient-[MAJKSerializer serializeObject:options:encodeOption:block:delegate:selector:error:] + 990 frame #3: 0x000000010995cc2e EverVCiOSClient`-[NSArray(MAJSONKitSerializing) JSONString] + 71

cocoZ avatar Dec 08 '15 11:12 cocoZ