且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从iOS应用程序发布在Facebook页面上不显示页面?

更新时间:2022-10-29 17:05:09

  NSDictionary * params = @ {
@ message:message,
@tags:Mystring,
@link:@http://www.miimobileapp.com/website/index.html,
@ privacy:@{'value':'SELF'},

};
/ *使API调用* /
FBSDKGraphRequest * request = [[FBSDKGraphRequest alloc]
initWithGraphPath:@/ me / feed
参数:params
HTTPMethod :@ POST];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection * connection,id result,NSError * error){
NSLog(@Post successful);
}

这是我如何在Facebook上发布视频希望这将有助于您


I am posting a picture and dummy text on a facebook page with the Page Id "848190045198980".I am signing in using my facebook credentials.Also I have admin role for the specific page.So I am just getting the basic permissions from facebook.Below is the request and the response.

Request :

UIImage * productImage = [UIImage imageNamed:@"corporate.png"]; NSData * imageData = UIImagePNGRepresentation(productImage);

NSDictionary *params = @{@"message": @"Hello XYZ", @"source":imageData};

[FBRequestConnection startWithGraphPath:@"/848190045198980/photos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {

    if(!error)
    {
        if(completionBlock)
        {

            NSLog(@"%@",result);
            completionBlock(YES,result,nil);
        }
    }
    else
    {
        if(completionBlock)
            completionBlock(NO,nil,error);
    }
}];

Response : {"id":"1481175438805031","post_id":"848190045198980_1481175438805031"}

Expected Result : My Post should show up on the Facebook Page in "Posts to Page" Section.

Actual Result : Nothing Shows Up.

Please point me in the right direction as to what I am missing here.I have checked the API Doc several times and I am finding it real tough as to where I am missing something.

Regards, Roman

NSDictionary *params = @{
                         @"message":message,
                         @"tags":Mystring,
                         @"link":@"http://www.miimobileapp.com/website/index.html",
                         @"privacy": @"{'value': 'SELF'}",

                         };
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                              initWithGraphPath:@"/me/feed"
                              parameters:params
                              HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,id result,NSError *error) {
NSLog(@"Post successful");
}

This is how I am posting video on facebook Hope this will help You