Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
BadSuNian opened this issue Sep 19, 2015 · 7 comments

Comments

@BadSuNian
Copy link

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

Xcode 7 reported the wrong how to solve the crash

@Gareth-swifter
Copy link

@BadSuNian
Copy link
Author

I've replaced the still crash tip:

Sep 19 14:18:35 XXXX[718] : 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] : 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] : CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

@caisd1998
Copy link

@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方法的要求,尤其是提供给别人使用的第三方库的时候,一定要加上前缀,以防影响到使用者。

@poorbird
Copy link

poorbird commented Oct 9, 2015

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

poorbird referenced this issue Oct 9, 2015
…rning.

The current (at the time of this writing) version of the `clang` static analyzer is complaing that the `objects` pointer is `NULL`.  This is a false positive warning from the analyzer.
@BadSuNian
Copy link
Author

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

@loveNoodles
Copy link

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 !

@cocoZ
Copy link

cocoZ commented Dec 8, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@loveNoodles @BadSuNian @Gareth-swifter @poorbird @cocoZ @caisd1998 and others