I had implemented Facebook App invites in Demo Application. It worked fine but did not get notification.
I have added all detail in my question, now can anyone tell me what is the issue in my code and what should I do to resolve this. I have created test users for testing this app.
This code works fine, it launches a dialogue box, showing the friend list and also shows that the app invite is sent but when I check it in friends account it doesn't show any notification.
My Info.plist File
I think I have a mistake in info.plsit under URL Type (URL Schemes). I had written action which is the name of the method but I don't have any idea what I should write in this column.
Appdelegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
BFURL *parsedUrl = [BFURL URLWithInboundURL:url sourceApplication:sourceApplication];
if ([parsedUrl appLinkData])
{
NSURL *targetUrl = [parsedUrl targetURL];
[[[UIAlertView alloc] initWithTitle:@"Received link:"
message:[targetUrl absoluteString]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] show];
}
return YES; }
ViewController.h
Getting result null when
appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
called
- (IBAction)action:(UIButton *)sender
{
FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"https://fb.me/*****************"];
[FBSDKAppInviteDialog showFromViewController:self withContent:content delegate:self];
}
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{
NSLog(@" result %@",results);
}
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error
{
NSLog(@"error = %@", error);
NSString *message = error.userInfo[FBSDKErrorLocalizedDescriptionKey] ?:
@"There was a problem sending the invite, please try again later.";
NSString *title = error.userInfo[FBSDKErrorLocalizedTitleKey] ?: @"Oops!";
[[[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}
See Question&Answers more detail:os