Last active
August 11, 2017 09:18
-
-
Save vinhnx/817fe5de3dd5c88e491e to your computer and use it in GitHub Desktop.
Example on how to determine Facebook app invite completion state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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... | |
} |
TY
Nice, thanks!
Nice, thank you!
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
Thank you,