Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuneJuneCute/039871a0731eff92ee52a1c30b3ab904 to your computer and use it in GitHub Desktop.
Save JuneJuneCute/039871a0731eff92ee52a1c30b3ab904 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...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment