I know the same kind of issue has already been posted, but I think I face another one.
I created the CocoaPod called NSURLSession+PromiseKit to allow using PromiseKit with NSURLSession.
I have the definition:
@implementation NSURLSession (PromiseKit)
- (PMKPromise *)promiseDataTaskWithURL:(NSURL *)url {
return [PMKPromise ...];
}
@end
And the code sample:
NSURLSession *session = [NSURLSession sharedSession];
NSURL *url = [NSURL URLWithString:@"..."];
[session promiseDataTaskWithURL:url].then( ^(NSData *data) {
NSLog(@"Result: %@", data);
}).catch( ^(NSError *e) {
NSLog(@"Error: %@", e);
});
works on iOS 8, but not on iOS 7. I get this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFURLSession promiseDataTaskWithURL:]: unrecognized selector sent to instance 0x7c236720'
Now of course I though that the category was not loaded so I added this line to the podspec to make sure that the code is loaded:
s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC -all_load' }
But it does not work better.
So I added a line to the category file:
+ (void)load {
NSLog(@"loaded");
}
To my surprise the load
method is called, which means that the code is indeed loaded. So why is the category method not found while executing if the code is loaded?