Objective-c - syntax for addObserver that returns a boolean value

429 Views Asked by At

I am trying to add an sdk call to my Xcode project, and in their documentation, they say:

"If you are using these API's you can become an observer for the following events:
NOTIFICATION_COMPLETED True/False - mail has completed with success/failure."

I managed to get this far:

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

or, I assume that is correct... I am not sure about the nil on the end though.

anyway, I have no idea how to format my _NotificationCompleted function...

this is what I wrote:

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

What am I doing wrong?

1

There are 1 best solutions below

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