I’ve added a category to UIApplication however I’m getting an unrecognized selector error at runtime.
Now the thing is this code has existed and been working for 10 months in another project, so I know there’s nothing fundamentally wrong with it.
I am in the process of creating a new project and am re-using the source files from the other project. I have added them unaltered to the new project, and they still continue to work in the old project. So I know this code should work in the new project.
I am at a loss as to why the exact same code is working in one project but not in another.
For reference the category is:
@interface UIApplication (NetworkActivity)
- (void)resetNetworkActivity;
@end
The call which fails:
[[UIApplication sharedApplication] resetNetworkActivity];
2012-10-18 14:19:26.134 IMS-Reference[5946:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIApplication resetNetworkActivity]: unrecognized selector sent to instance 0x1e58e240'
*** First throw call stack:
Any thoughts why its not working?
Typically, this is because your
*.mfile is not in the target’s compile phases. So… just triple-check that 🙂