melwyn pawar melwyn pawar - 2 years ago 117
Swift Question

ios swift 2 post on facebook page on behalf of the page

facebook provided the below code to post on to a page, however i am unable to find a swift version of the code also considering facebook has moved to FBSDKGraphRequest v2.6

NSDictionary *params = @{
@"message": @"This is a test message",
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result

Answer Source

This get's the job done

let request = FBSDKGraphRequest(graphPath: "page-id/feed", parameters: ["Message" : "Hello there"], HTTPMethod: "POST")

    request.startWithCompletionHandler { (connection, result, error) in
        //Handle the request

You can setup you params with whatever you want. Read about the params here: FBSDK

Read more here: Facebook

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download