“dylib”如何callback主程序?

我正在与一个拦截iPhone越狱的程序。 我用dylib来拦截系统调用事件,但是我怎么callback我的主程序并处理这个事件呢?

您可以使用CFNotificationCenter从您的dylib发送达尔文通知到应用程序。 这是限制性的,没有用户数据可以传递,但你至less可以通知应用程序的事件。 更多信息,请访问https://developer.apple.com/library/IOs/#documentation/CoreFoundation/Reference/CFNotificationCenterRef/Reference/reference.html

Example of registering and posting: CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),NULL, &NotificationReceivedCallback,(CFStringRef)MyNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce); CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter() , CFSTR(MyNotificationString), NULL, NULL, YES);