Skip to content

Instantly share code, notes, and snippets.

@vinhnx
Last active August 11, 2017 09:18
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vinhnx/817fe5de3dd5c88e491e to your computer and use it in GitHub Desktop.
Save vinhnx/817fe5de3dd5c88e491e to your computer and use it in GitHub Desktop.
Example on how to determine Facebook app invite completion state
#pragma mark - Facebook App Invite Delegate
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"app invite result: %@", results);
BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue];
NSString *completionGesture = [results valueForKeyPath:@"completionGesture"];
// NOTE: the `cancel` result dictionary will be
// {
// completionGesture = cancel;
// didComplete = 1;
// }
// else, it will only just `didComplete`
if (completionGesture && [completionGesture isEqualToString:@"cancel"]) {
// handle cancel state...
return;
}
if (complete) { // if completionGesture is nil -> success
[SVProgressHUD showSuccessWithStatus:NSLocalizedString(@"Your invite has been sent.", nil)];
}
}
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error
{
NSLog(@"app invite error: %@", error.localizedDescription);
// handle error...
}
@BunLV
Copy link

BunLV commented Mar 9, 2016

Thank you,

@brbgyn
Copy link

brbgyn commented Jul 22, 2016

TY

@remstos
Copy link

remstos commented Feb 7, 2017

Nice, thanks!

@iThanh
Copy link

iThanh commented Mar 6, 2017

Nice, thank you!

@avanish
Copy link

avanish commented May 22, 2017

I'm implementing this right now, still waiting for the app link URL for now from the web dev. I was wondering what key-value pairs you get in the result? Do we get a count for the number of invites by any chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment