系统通知劫持中的问题

我在TapJoy的广告墙,读取官方文档后。我hook了相应的方法并自己重写了NSNotification的发送,但程序还是能读到原来的广告墙积分,有什么思路吗?我Hook的方法是getTapPoints
然后使用NSString* aname=@“TJC_TAPPOINTS_EARNED_NOTIFICATION”;

id anObject = [NSNumber numberWithInt:99999999];
[NSNotification notificationWithName:aname object:anObject];

NSString* Bname =@“TJC_TAP_POINTS_RESPONSE_NOTIFICATION”;
[NSNotification notificationWithName:Bname object:anObject];
NSString * Cname=@“TJC_VIDEO_OBJ_CURRENCY_AMOUNT”;
[NSNotification notificationWithName:Cname object:anObject]; 覆盖了这些方法,但是libNotify中程序还是读取了原来的通知

官方文档对getTapPoints的描述是Requests for Tap Points (Virtual Currency) notify via TJC_TAP_POINTS_RESPONSE_NOTIFICATION notification.
hook前后libnotify输出TapjoyEasyApp[9788]: LibNotifyWatch: <CFNotificationCenter 0x14d67bf0 [0x389e9ad0]> postNotificationName:TJC_TAP_POINTS_RESPONSE_NOTIFICATION object:1240 userInfo:(null)
1240就是我自己的积分

就你发的这一小段代码来看,并没有重写任何函数调用。最好是把整段代码po出来

//TapJoy 10.X And After
%ctor{
	NSString* aname=@"TJC_TAPPOINTS_EARNED_NOTIFICATION";
	id anObject = [NSNumber numberWithInt:99999999];
	[NSNotification notificationWithName:aname object:anObject];
	NSString* Bname =@"TJC_TAP_POINTS_RESPONSE_NOTIFICATION";
	[NSNotification notificationWithName:Bname object:anObject];
	NSString * Cname=@"TJC_VIDEO_OBJ_CURRENCY_AMOUNT";
	[NSNotification notificationWithName:Cname object:anObject];
}

%hook Tapjoy
-(void)getTapPoints{
	NSString* aname=@"TJC_TAPPOINTS_EARNED_NOTIFICATION";
	id anObject = [NSNumber numberWithInt:99999999];
	[NSNotification notificationWithName:aname object:anObject];
	NSString* Bname =@"TJC_TAP_POINTS_RESPONSE_NOTIFICATION";
	[NSNotification notificationWithName:Bname object:anObject];
}
%end

%hook TapjoyConnect
-(void)getTapPoints{
	NSString* aname=@"TJC_TAPPOINTS_EARNED_NOTIFICATION";
	id anObject = [NSNumber numberWithInt:99999999];
	[NSNotification notificationWithName:aname object:anObject];
	NSString* Bname =@"TJC_TAP_POINTS_RESPONSE_NOTIFICATION";
	[NSNotification notificationWithName:Bname object:anObject];
}
%end

//End TapJoy After 10.x

你这段代码并不能称之为重写了Notification的发送,而是重写了getTapPoints这个函数。如果在有没有你dylib的情况下libnotifywatch都能捕获到TJC_TAP_POINTS_RESPONSE_NOTIFICATION这个notification,那你就要看看这个notification到底是不是从getTapPoints里面发出的,我觉得不是

官方文档写在这里,而且libnotify没有捕获到我自己发的这个99999999的

你是用NSNotificationCenter发的,而上面显示的libnotifywatch捕获的是CFNotificationCenter发的。你看看libnotifywatch的配置里是不是勾选了NSNotificationCenter