0

我在我的应用程序中选择我的脸书朋友我想在我的朋友墙上发布一些文本数据,因为我按下完成按钮时按下完成按钮我得到这个,error.Error: HTTP status code: 400 嘿嘿是我的代码

- (void)facebookViewControllerDoneWasPressed:(id)sender {
    NSMutableString *text = [[NSMutableString alloc] init];

    // we pick up the users from the selection, and create a string that we use to update the text view
    // at the bottom of the display; note that self.selection is a property inherited from our base class
    for (id<FBGraphUser> user in self.friendPickerController.selection) {

        NSString *userID = user.id;
        NSLog(@"trying to post image of %@ wall",userID);
        NSMutableDictionary  *postVariablesDictionary = [[NSMutableDictionary alloc] init];
        //[postVariablesDictionary setObject:UIImagePNGRepresentation(image) forKey:@"picture"];
        [postVariablesDictionary setObject:@"my image" forKey:@"message"];

        [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/photos",userID] parameters:postVariablesDictionary HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
         {
             if (error)
             {
                 //showing an alert for failure
                 UIAlertView *alertView = [[UIAlertView alloc]  initWithTitle:@"Facebook" message:error.localizedDescription                                                                                                delegate:nil   cancelButtonTitle:@"OK"              otherButtonTitles:nil];
                 [alertView show];
             }
             else
             {
                 //showing an alert for success
                 UIAlertView *alertView = [[UIAlertView alloc]  initWithTitle:@"Facebook" message:@"Shared the photo successfully"                                                                                                delegate:nil   cancelButtonTitle:@"OK"              otherButtonTitles:nil];
                 [alertView show];
             }
         }];


    }
     NSLog(@"%@",text);
    [self fillTextBoxAndDismiss];
   }
4

0 回答 0