Using undeclare identifier 'FBRequestConnection'

I am trying to implement Facebook functionality, but I have an error in the following line of code:

 [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/photos",[fbidarray objectAtIndex:j]] parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error1)

      

Mistake:

use of undeclare identifier 'FBRequestConnection'

      

I imported the following frameworks:

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

      

Does any of you know why the error is?

I will be very grateful for your help.

+3


source to share


1 answer


Use FBSDKGraphRequest

instead.

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me"
                                                                 parameters:nil];
  [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // TODO: handle results or error of request.
  }];

      

This is from the docs



Requests - FBSDKGraphRequest and FBSDKGraphRequestConnection reside in FBSDKCoreKit and provide helpers access to the Graph API. They are very similar to FBRequest and FBRequestConnection in v3.x. By default, they use [FBSDKAccessToken currentAccessToken] to issue requests, so you usually issue requests after logging in.

Also I searched FBRequestConnection

facebook sdk but couldn't find it.

+2


source







All Articles