pizzafilms
pizzafilms

Reputation: 4019

ShareKit 2.0: How to get notification of Sharer authorization?

I need to know when a sharer has been authorized (to change some UI) and it looks like there's a SharerDelegate sharerAuthDidFinish method which (I think) I implemented, but it doesn't get called.

Anyone?

Thanks!

Upvotes: 1

Views: 603

Answers (1)

rosslebeau
rosslebeau

Reputation: 1283

In SHKSharer.m, there is the following code:

- (void)authDidFinish:(BOOL)success 
{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"SHKAuthDidFinish" object:self userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:success] forKey:@"success"]];  

    if ([self.shareDelegate respondsToSelector:@selector(sharerAuthDidFinish:success:)]) {      
        [self.shareDelegate sharerAuthDidFinish:self success:success];
    }
}

So you can listen for the notification in whatever class needs to know like such:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharerAuthorized:) name:@"SHKAuthDidFinish" object:nil];

and then implement a method like:

- (void)sharerAuthorized:(NSNotification *)notification {
    //check for success and type of sharer
    //do whatever you need to do once it is authorized
}

Upvotes: 3

Related Questions