Friday, April 5, 2013

NSURL *baseURL = [NSURL URLWithString:@"https://graph.facebook.com/"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:baseURL];

NSString *link = [NSString stringWithFormat:@"/%@/likes", @"OBJECT_ID"];
NSDictionary *params = @{@"access_token" : [[[FBSession activeSession] accessTokenData] accessToken]};

[httpClient postPath:link parameters:params success:^(AFHTTPRequestOperation *op, id result) {

    NSLog(@"result %@", result);

  } failure:^(AFHTTPRequestOperation *operation, NSError *error) {

    NSLog(@"error %@", error);

}];
That's it, don't hesitate to comment, to share your knowledge and to correct me.

3 comments: