The operation could not be completed. (error com.facebook.sdk.core 8.)

Hi, I am using ios8 for facebook, which transfers the image from the iphone application to facebook, and when I click the photo button, I get this error "Operation could not be completed (com.facebook.sdk 8. error)

this is the code i used to share image from iphone to facebook app.

- (IBAction)photo:(id)sender
            {
                FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
                [login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
                 {
                     if (error)
                     {
                         // Process error
                     }
                     else if (result.isCancelled)
                     {
                         // Handle cancellations
                     }
                     else
                     {
                         if ([result.grantedPermissions containsObject:@"email"])
                         {
                             //NSLog(@"result is:%@",result);

                             [self photo];

                         }
                     }
                 }];
            }

            - (void)photo
            {
                FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
                FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
                UIImage *image = [UIImage imageNamed:@"TEST.png"];

                NSDictionary *parameters = @{
                                             @"message" : @"welcome",
                                             @"picture" : UIImagePNGRepresentation(image),
                                             };

                FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/photos" parameters:parameters tokenString:token.tokenString version:@"nil" HTTPMethod:@"POST"];
                [connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                    if(error)
                        NSLog(@"%@", error);
                    else
                        NSLog(@"Success");
                }];

                [connection start];
            }

This is the error I get

fb sharing[1065:90399] Error Domain=com.facebook.sdk.core Code=8 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)" UserInfo=0x155c7720 {com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2500, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 2500;
            "fbtrace_id" = ErePY87sZ34;
            message = "Unknown path components: /me/photos";
            type = OAuthException;
        };
    };
    code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unknown path components: /me/photos, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}

Any help is appreciated.

+4
source share

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


All Articles