Dave Gallant
Dave Gallant

Reputation: 1

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

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?

Upvotes: 0

Views: 420

Answers (1)

lambmj
lambmj

Reputation: 1843

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

Upvotes: 0

Related Questions