Facebook SDK uses Graph API version 1.0

There are some differences between the versions of the Facebook Graphics API 1.0 and 2.0 that I don’t like so much, so I would like to move on to the graphical API version 1.0.

Any ideas how to do this?

Here is the code I'm using right now that is invoking version 2.0:

[FBRequestConnection startWithGraphPath:@"/me/friends"
                             parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"20", @"limit", nil]
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                          if (!error) {
                              // Sucess! Include your code to handle the results here
                              NSLog(@"***** user friends with params: %@", result);
                          } else {
                              // An error occurred, we need to handle the error
                          }
                      }];
+4
source share
2 answers

This can be done at a level FBRequest.

You need to create FBRequest yourself and use it overrideVersionPartWith:.

Remember that this will only work if your Facebook application was created before API v2.0 was released. New applications are blocked from using the old API in general.

:

FBRequest *request = [FBRequest requestWithGraphPath:@"/me/friends"
                                          parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"20", @"limit", nil]
                                          HTTPMethod:@"GET"];
[request overrideVersionPartWith:@"v1.0"];

[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                          if (!error) {
                              // Success! Include your code to handle the results here
                              NSLog(@"***** user friends with params: %@", result);
                          } else {
                              // An error occurred, we need to handle the error
                          }
                      }];
+6

,

[FBSettings enablePlatformCompatibility: YES];

FbRequests target api v1.0 : https://developers.facebook.com/docs/reference/ios/current/class/FBSettings/

, v1.0 api, :

[FBRequestConnection startWithGraphPath:@"v1.0/me/friends"
                         parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"20", @"limit", nil]
                         HTTPMethod:@"GET"
                  completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                      if (!error) {
                          // Sucess! Include your code to handle the results here
                          NSLog(@"***** user friends with params: %@", result);
                      } else {
                          // An error occurred, we need to handle the error
                      }
                  }];

, https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/

. overrideVersionPartWith: method

+7

Source: https://habr.com/ru/post/1543286/


All Articles