代码拉取完成,页面将自动刷新
//
// NSMutableDictionary+RunTime.m
// EDCsfzs
//
// Created by feng on 16/9/26.
// Copyright © 2016年 冯宝东. All rights reserved.
//
#import "NSMutableDictionary+RunTime.h"
#import "FBDSwizzingTool.h"
#import <Foundation/NSObject.h>
@implementation NSMutableDictionary (RunTime)
+(void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = NSClassFromString(@"__NSDictionaryM");
[FBDSwizzingTool fbdSwizzingClass:class OriginSelectName:@"setObject:forKey:" overName:@"fbd_setObject:forKey:"];
});
// Class class=NSClassFromString(@"__NSDictionaryM");
// SEL originSEL= NSSelectorFromString(@"setObject:forKey:");
// SEL overSEL= NSSelectorFromString(@"fbd_setObject:forKey:");
// Method originM= class_getInstanceMethod(class, originSEL);
// Method overM=class_getInstanceMethod(class, overSEL);
// BOOL didAddM=class_addMethod(class, originSEL, method_getImplementation(overM), method_getTypeEncoding(overM));
// if (didAddM)
// {
// class_replaceMethod(class, overSEL, method_getImplementation(originM), method_getTypeEncoding(originM));
// }else
// {
// method_exchangeImplementations(originM, overM);
//
// }
}
-(void)test:(NSString*)objValue
{
[self setObject:@"wq" forKey:@"11"];
}
-(void)fbd_setObject:(id)anObject forKey:(id<NSCopying>)aKey
{
if (!anObject||[anObject isEqual:[NSNull null]]) {
NSLog(@"fbd_setObject 为 null 或者为 nil");
[self fbd_setObject:@"fit_null" forKey:aKey];
return;
}
if (!aKey) {
return;
}
[self fbd_setObject:anObject forKey:aKey];
}
@end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。