Methods implemented in categories on NSURLSession cause crashes.
| Originator: | chris95schweich | ||
| Number: | rdar://18174733 | Date Originated: | 29-Aug-2014 |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7 |
| Classification: | Crash | Reproducible: | yes |
Summary:
If you add a method to NSURLSession using a category, the app will throw an exception at runtime when trying to call the method.
Steps to Reproduce:
Create a category on NSURLSession and implement a method.
Create a NSURLSession object.
Call the category-method on the created method.
Expected Results:
As there is no hint in the documentation that mentions this behavior, I expect the method to be loaded at runtime and to work properly.
Actual Results:
An NSInvalidArgumentException ('unrecognized selector sent to instance') is thrown when calling the method. The app crashes if the exception is not caught.
Version:
iOS 7.1.2
Notes:
I created a sample project documenting the case. The error occurs when running the app.
Configuration:
iPhone Simulator, iPad mini (Retina)
Attachments:
'URLSessionCategoryBugSample.zip' http://dl.cschwarz.com/31292313230011f4b423ac641e29d260.zip
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!