Search code examples
iphoneiosxcode4

Runtime error for Release build app in XCode 4


I'm having some issues with running a app in Release build in Xcode 4. I get a run-time error on a message send to a Category method:

[NSCFString JSONValue]: unrecognized selector sent to instance 0x923600

I guess the category for some reason is not found correctly. There is no warnings, and this only happens in Release builds. The JSON Category is located in a static lib, linked to the main app. The project configuration still contains the -all_load flag.

EDIT:

This is the offending code:

    NSString *rawJson = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] ;
    NSDictionary *dataDic =[rawJson JSONValue];

the rawJson contains a valid string, and everything is working perfectly fine in debug builds

Any suggestions?

Thanx!


Solution

  • I just found the reason for this issue: The project configuration specified the needed linker flags (-ObjC -load_all) for both release and debug, but the target itself only had the needed linker flags for debug. After adding the linker flags to the target's release, everything works again.