这是行动代码
-(void)fnInvitefb {
//Facebook Code
NSString *facebookID = @"100000797858986";
NSDictionary *parameters = @{@"to":@"100000739625716"
};
[FBWebDialogs presentRequestsDialogModallyWithSession:nil
message:@"Test msg"
title:@"Test Title"
parameters:parameters
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if(error)
{
NSLog(@"Some errorr: %@", [error description]);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed"
message:@"Unable to send inviation at this Moment, please make sure your are connected
with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
}
else
{
if (![resultURL query])
{
return;
}
NSDictionary *params = [self parseURLParams:[resultURL query]];
NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
for (NSString *paramKey in params)
{
if ([paramKey hasPrefix:@"to["])
{
[recipientIDs addObject:[params objectForKey:paramKey]];
}
}
if ([params objectForKey:@"request"])
{
NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
}
if ([recipientIDs count] > 0)
{
//[self showMessage:@"Sent request successfully."];
//NSLog(@"Recipient ID(s): %@", recipientIDs);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!"
message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alrt show];
}
}
}
friendCache:nil];
// NSString *facebookID = @"100000797858986";
}
并在app委托功能代码
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Set app's client ID for |GPPSignIn| and |GPPShare|.
[GPPSignIn sharedInstance].clientID = kClientID;
[GPPSignInButton class];
[FBLoginView class];
[FBProfilePictureView class];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[GPPDeepLink setDelegate:self];
[GPPDeepLink readDeepLinkAfterInstall];
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
NSString *urlString = [url absoluteString];
if([urlString rangeOfString:@"681678928556808"].location==NSNotFound)
{
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
else
{
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
}
return [GPPURLHandler handleURL:url
sourceApplication:sourceApplication
annotation:annotation];
}
还在列表中配置相同的id是正确的或任何错误的东西。