Moving AFSwizzleClassMethodWithClassAndSelectorUsingBlock function
This commit is contained in:
parent
45880fd9a0
commit
df140116b8
1 changed files with 6 additions and 6 deletions
|
|
@ -60,12 +60,6 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) {
|
||||||
return [NSSet setWithSet:mutableContentTypes];
|
return [NSSet setWithSet:mutableContentTypes];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, id block) {
|
|
||||||
Method originalMethod = class_getClassMethod(klass, selector);
|
|
||||||
IMP implementation = imp_implementationWithBlock((AF_CAST_TO_BLOCK)block);
|
|
||||||
class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod));
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
||||||
NSMutableString *string = [NSMutableString string];
|
NSMutableString *string = [NSMutableString string];
|
||||||
|
|
||||||
|
|
@ -96,6 +90,12 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, id block) {
|
||||||
|
Method originalMethod = class_getClassMethod(klass, selector);
|
||||||
|
IMP implementation = imp_implementationWithBlock((AF_CAST_TO_BLOCK)block);
|
||||||
|
class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod));
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
|
||||||
@interface AFHTTPRequestOperation ()
|
@interface AFHTTPRequestOperation ()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue