Skip to content

Instantly share code, notes, and snippets.

@gfx
Created October 7, 2014 05:00
Show Gist options
  • Save gfx/6424e1c6a832ae16465c to your computer and use it in GitHub Desktop.
Save gfx/6424e1c6a832ae16465c to your computer and use it in GitHub Desktop.

AFNetworking 2.4.1 has a bug that it crashes on unit testing (⌘u on Xcode). This is caused by addObserver methods so I ignore them on unit testing.

@interface AFHTTPRequestSerializer (Test)
@end

@implementation AFHTTPRequestSerializer (Test)

- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context {
    NSLog(@"ignore %s (keyPath=%@)", __FUNCTION__, keyPath);
}
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context {
    NSLog(@"ignore %s (keyPath=%@)", __FUNCTION__, keyPath);
}
- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath {
    NSLog(@"ignore %s (keyPath=%@)", __FUNCTION__, keyPath);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment