Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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