0

In my app I need to implement +add as friend type button to send Facebook adding as friend request. After searching the internet,I did it following the method: http://developers.facebook.com/docs/reference/dialogs/friends/

    AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
    //                                   kAppId, @"app_id",
    //                                   @"popup",@"display",
                               @"100000979054002",@"id",
                               nil];
    [delegate.facebook dialog:@"friends" andParams:params andDelegate:self];

but i got an error: "An error occurred. Please try again later."
Is there somebody could give me a help? Thanks in advance.

Linc
  • 1,279
  • 12
  • 16

2 Answers2

0

Take a look here

The above question is about Android, but it's the same for iOS. All you need is change the base url (usually defined in Facebook.h as kDialogBaseURL) from m.facebook.com to www.facebook.com. That solved the issue for me.

Community
  • 1
  • 1
Igor N
  • 381
  • 2
  • 6
0

From: http://developers.facebook.com/docs/reference/dialogs/#display

Mobile Display Modes

To show a dialog to a user on a mobile device, change the subdomain of the dialog URL from www to m. Facebook will default to an appropriate view based on the user agent. To override that choice, you can explicitly specify one of two mobile display modes:

  • touch: Used on smartphone mobile devices, like iPhone and Android. Use this for tablets with small screens (i.e., under 7 inches) as well.
  • wap: Display plain HTML (without JavaScript) on a small screen, such as a Nokia 7500.

Maybe "popup" is the incorrect display for a mobile device?

Also, are the // comments? If so, you've commented out the required field of app_id.

DMCS
  • 31,720
  • 14
  • 71
  • 104