2

I'm following these two tutorials in Facebook developer website https://developers.facebook.com/docs/tutorials/ios-sdk-games/requests/

https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/#step2

These are my codes:

[FBWebDialogs presentRequestsDialogModallyWithSession:nil
     message:[NSString stringWithFormat:@"I just smashed %u friends! Can you beat it?", score]
     title: nil
     parameters:params
     handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
    {
         if (error)
         {
             // Case A: Error launching the dialog or sending request.
             UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @"Facebook" message: error.description delegate: nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
             [alert show];
             [alert release];
         }
         else
         {
             if (result == (FBWebDialogResultDialogCompleted))
             {
                 // Handle the publish feed callback
                 NSDictionary *urlParams = [self parseURLParams:[resultURL query]];

                 if ([urlParams valueForKey: @"request"])
                 {
                     // User clicked the Share button
                     NSLog(@"Send");
                 }
             }
         }
    }];

Problem is after I send out the request, my friend told me that he doesn't receive any notification/request in FB Notification Center site. Does anyone know why?

These are the things I've done:

  1. I've setup properly in info.plist and the Facebook App.

  2. I'm not using Sandbox mode.

  3. My current application is able to log in and post to wall.

  4. I've publish_actions permission.

  5. I did not received any error or warning.

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Cadrick Loh
  • 721
  • 1
  • 7
  • 19

2 Answers2

5

I found my solution here: Facebook App Requests aren't shown on iOS devices?

It is because I didn't set the iPhone App ID and iPad App ID

Community
  • 1
  • 1
Cadrick Loh
  • 721
  • 1
  • 7
  • 19
0

Use following method, it will help you :

-(void)openFacebookAuthentication
{
    NSArray *permission = [NSArray arrayWithObjects:kFBEmailPermission,kFBUserPhotosPermission, nil];

    FBSession *session = [[FBSession alloc] initWithPermissions:permission];

    [FBSession setActiveSession: [[FBSession alloc] initWithPermissions:permission] ];

    [[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorForcingWebView completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {

        switch (status) {
            case FBSessionStateOpen:
                [self getMyData];
                break;
            case FBSessionStateClosedLoginFailed: {
                // prefer to keep decls near to their use
                // unpack the error code and reason in order to compute cancel bool
                NSString *errorCode = [[error userInfo] objectForKey:FBErrorLoginFailedOriginalErrorCode];
                NSString *errorReason = [[error userInfo] objectForKey:FBErrorLoginFailedReason];
                BOOL userDidCancel = !errorCode && (!errorReason || [errorReason isEqualToString:FBErrorLoginFailedReasonInlineCancelledValue]);

                //Added by Rigel Networks July 2, 2013 to solve Facebook Cancel button popup issue
                if(error.code == 2 && ![errorReason isEqualToString:@"com.facebook.sdk:UserLoginCancelled"]) {
                    UIAlertView *errorMessage = [[UIAlertView alloc] initWithTitle:kFBAlertTitle
                                                                           message:kFBAuthenticationErrorMessage
                                                                           delegate:nil
                                                                           cancelButtonTitle:kOk
                                                                           otherButtonTitles:nil];
                    [errorMessage performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:YES];
                    errorMessage = nil;
                    }
                }
                break;
                // presently extension, log-out and invalidation are being implemented in the Facebook class
            default:
                break; // so we do nothing in response to those state transitions
        }
    }];
    permission = nil;
}
sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Divya Bhaloidiya
  • 5,018
  • 2
  • 25
  • 45