ios - NSURLSessionTask category method crashes with "Unrecognized selector sent to instance" -


i need add method nsurlsessiontask. here's category supposed that:

//  nsurlsessiontask+extras.h  #import <foundation/foundation.h>  @interface nsurlsessiontask (extras)  - (void)hellonsurlsessiontask;  @end  //  nsurlsessiontask+extras.m  #import "nsurlsessiontask+extras.h"  @implementation nsurlsessiontask (extras)  - (void)hellonsurlsessiontask {     nslog(@"hello nsurlsessiontask!"); }  @end 

everything compiles well, autocomplete works, when call method, application crashes:

2014-06-27 12:32:23.916 test[4333:60b] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscflocaldatatask hellonsurlsessiontask]: unrecognized selector sent instance 0x109723310' 

same approach works if add category nsobject, , can't seem understand why doesn't nsurlsessiontask.

here's test project reproduces problem me: https://dl.dropboxusercontent.com/u/25100182/test.zip

unfortunately doesn't seem nsurlsession can support categories. i've run problem trying add associated object.
see here.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -