Objective-c - addObserver的语法,返回一个布尔值

时间:2011-12-02 21:03:49

标签: objective-c parameters callback nsnotification addobserver

我正在尝试向我的Xcode项目添加一个sdk调用,并在他们的文档中说:

  

“如果您使用这些API,您可以成为以下事件的观察者:
  NOTIFICATION_COMPLETED是/否 - 邮件已成功完成/失败。“

我设法做到这一点:

[[NSNotificationCenter defaultCenter] addObserver: rootViewController
                                         selector: @selector(_NotificationCompleted:)
                                             name: NOTIFICATION_COMPLETED
                                           object: nil];

或者,我认为这是正确的......但我不确定最后的结果是否为零。

无论如何,我不知道如何格式化我的_NotificationCompleted函数......

这就是我写的:

void _NotificationCompleted(Boolean WasSuccessfullySent)
{
     if(WasSuccessfullySent)
     {
          // YAY!
     } else {
          // Boo!
     {
}

我做错了什么?

1 个答案:

答案 0 :(得分:0)

- (void)_NotificationCompleted:(NSNotification *)notification {
     // your code goes here.
}