ios - Under what conditions might instancesRespondToSelector: return true, but performSelector: throw an exception -


i have code distributed in library looks this:

if ([[nsstring class] instancesrespondtoselector: @selector(jsonvalue)]) {   nsstring *jsonstring = [[[nsstring alloc] initwithdata: jsondata encoding: nsutf8stringencoding] autorelease];   dict = [jsonstring performselector: @selector(jsonvalue)]; } 

for reason -[__nscfstring jsonvalue]: unrecognized selector sent instance exception getting thrown when performselector: method gets called. code distributed in library wrote, can't reproduce or debug myself. instead third-party reporting problem. under conditions instancesrespondtoselector: while calling method using performselector: throw exception?

edit there case explain why occurs, doesn't make sense. if developers this:

@implementation nsstring (ourhappycategory)  + (bool)instancesrespondtoselector:(sel)aselector {   return yes; }  @end 

it explain why code executing, of course very bad thing do. there way problem occur makes sense?

nsstring class cluster, , brings sorts of complications... need ask instance if responds selector.

nsstring *jsonstring = [[[nsstring alloc] initwithdata: jsondata encoding: nsutf8stringencoding] autorelease]; if ([jsonstring respondstoselector: @selector(jsonvalue)]) {   dict = [jsonstring performselector: @selector(jsonvalue)]; } 

but problem has compiling or linking extension... if category added in library need sprinkle in -objc linker flag.

edit:
have been working little bit on reproducing issue... unable to... have more information.. example failure occurring on simulator, or on device, ios 4.x, gnu linker vs lldb's linker, abi/runtime differences?


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -