如何在Logos Tweak中发布通知

时间:2012-09-05 08:08:59

标签: ios nsnotificationcenter tweak logos

我使用iOSOpenDev创建一个Logos Tweak来挂钩acknowledgeIncomingMessageWithId:的{​​{1}},我想通过CTMessageCenter向另一个应用发送通知,但它不起作用。我认为NSNotificationCenter可以在不同的应用程序之间工作。我首先尝试在调整中测试NSNotificationCenter。这就是我在下面所做的:

NSNotificationCenter

但它不起作用。此外,UIAlertView没有出现。谁能告诉我为什么?

2 个答案:

答案 0 :(得分:1)

要在应用之间进行通知:

CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), 
                                NULL, 
                                doingSMS,
                                CFSTR("com.your.company.SMSComing"), 
                                NULL, 
                                CFNotificationSuspensionBehaviorCoalesce);

然后

CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), 
                                     CFSTR("com.your.company.SMSComing"), 
                                     NULL, 
                                     NULL, 
                                     TRUE);

请注意,"SMSComing"之类的通知名称(没有前缀)可能会出现问题。

答案 1 :(得分:0)

我遇到的问题是UIAlertViews没有出现在我正在使用iOSOpenDev的调整中。
我意识到我必须将UIAlertView的委托设置为self。出于某种原因,我不理解,当我将委托设置为nil时,UIAlertView将不会出现。

相关问题