我有一个ios应用程序,我将facebook放入。
我需要实现应用程序请求 - 我在Facebook开发人员页面上编写了示例中给出的代码
如果我运行调试,我会收到一个请求ID - 告诉我发送了请求
当我将请求发送到我的测试用户帐户时,我检查设备中facebook应用程序内的通知选项卡,它没有来自我的应用程序的任何请求。 怎么样?
这是我的代码:
-(void)invite:(NSString *)message{
if(![self isLoggedInWithFacebook]){
self.isRequestingInvite = YES;
self.inviteMessage = message;
[self facebookPerformLoginWithLoginUI:YES];
}
[FBWebDialogs
presentRequestsDialogModallyWithSession:nil
message:message
title:nil
parameters:nil
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or sending the request.
NSLog(@"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled request.");
} else {
// Handle the send request callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
LogInfo(@"urlParams:%@",urlParams);
if (![urlParams valueForKey:@"request"]) {
// User clicked the Cancel button
NSLog(@"User canceled request.");
} else {
// User clicked the Send button
NSString *requestID = [urlParams valueForKey:@"request"];
NSArray *to =[urlParams valueForKey:@"to"];
NSLog(@"Request ID: %@", requestID);
if([self.delegate respondsToSelector:@selector(appRequestSentTo:withID:)]){
[self.delegate appRequestSentTo:to withID:requestID];
}
}
}
}
}];
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [FBSession.activeSession handleOpenURL:url];
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Handle the user leaving the app while the Facebook login dialog is being shown
// For example: when the user presses the iOS "home" button while the login dialog is active
[FBAppCall handleDidBecomeActive];
}
注意:facebook登录工作正常