Can we invite people to use our app or send friend request from the app via Facebook in iOS 5?

后端 未结 2 1641
萌比男神i
萌比男神i 2020-12-01 23:54

Consider X and Y are friends in Facebook and they both have installed an app in their respective phones. But they are not

相关标签:
2条回答
  • 2020-12-02 00:36

    Use Facebook-sdk 3.1

    User-generated requests are initiated when the app enables the user to select one or more friends to send a request to.

    We will walk you through the steps to send out an invite or a request:

    • Triggering when the invitation or request is sent
    • Sending the request
    • Sending additional data with the request, such as a virtual gift

    You can set up your app to prompt the user to send out an invite after the user has used the app a certain number of times. You should also give the user the ability to invite friends to use the app at any time through the use of a menu button they can always get to. In this step we will show you a simple way of triggering the invitation request.

    See https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/#protip2 for different types of coding logic.

    See also:

    1. How to send add friend request (to facebook user) from iOS application?
    2. Can a facebook friend request be sent from my own app?
    0 讨论(0)
  • 2020-12-02 00:37

    Make sure your facebook app id is same in both developer page and info in xcode next, enable sandbox mode,and must fill canvas url [under app on facebook category] in developer page.

    NSString *facebookID = @"Your friend facebook id";
        NSMutableDictionary* params =
        [NSMutableDictionary dictionaryWithObject:facebookID forKey:@"to"];
    
        NSString *message = @"SOME_MESSAGE";
        NSString *title = @"TITLE";
    
        [FBWebDialogs presentRequestsDialogModallyWithSession:nil
                      message:message
                    title:title
                    parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                            if (error)
                        {
                        // Case A: Error launching the dialog or sending request.
                            NSLog(@"Error sending request.");
                        }
                        else
                        {
                            if (result == FBWebDialogResultDialogNotCompleted)
                        {
                        // Case B: User clicked the "x" icon
                            NSLog(@"User canceled request.");
                        }
                        else
                        {
                            NSLog(@"Request Sent. %@", params);
                        }
            }}];
    
    0 讨论(0)
提交回复
热议问题