I used the iOSOpenDev to create a Logos Tweak to hook the acknowledgeIncomingMessageWithId:
of CTMessageCenter
and I want to send notification by NSNotificationCenter
to another app, but it doesn't work. I think that the NSNotificationCenter
can work between different apps. I tried to test the NSNotificationCenter
in tweak, first. That's what I did below:
%hook CTMessageCenter
-(void)acknowledgeIncomingMessageWithId:(unsigned int)anId {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(doingSMS)
name:@"SMSComing"
object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMSComing" object:nil];
}
%orig;
}
- (void)doingSMS{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"短信消息传送成功"
message:@"来短信啦"
delegate:nil
cancelButtonTitle:@"Good"
otherButtonTitles:nil];
[alert show];
[alert release];
}
%end
But it doesn't work. Also,the UIAlertView is not appearing. Who can tell me why?