各位大佬,我尝试用method swizzle 去 hook某个函数。
但是在block 中 获取的did 跟我设置的不符 是个随机字符串。跪求各位大佬 看看 是什么原因
@interface xxxx : NSObject
@property (nonatomic,copy) NSString* did;
@end
+ ( **instancetype** )shared {
**static xxxx* single = **nil** ;
**static** dispatch_once_t onceToken = 0;
dispatch_once(&onceToken, ^{
single = [[ **self** alloc] init];
});
**return** single;
}
myblock block = ^(id _self,bool show) {
call orig();
NSString* did = [[xxxx shared] did];
NSLog(@"did: %@",did);
return ;
};