Search code examples
iosfacebook-ios-sdkfacebook-sdk-3.0

IOS: facebook sdk per my own post


I have a question about sdk facebook integration with my iOS app. In my app I want authenticate the users with the facebook login and it's all clear here

http://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/

In this app the users should post something in their facebook account, as a photo or a message, not complicated yet.

The problem is... is it possible detect the number of comments and like that users receive for their posts? Is there something in facebook sdk that allow to obtain this information?

thanks


Solution

  • Use following code and you can get more idea from Facebook iOS SDK 3.0, implement like action on a url? also.

    NSString *urlToLikeFor = facebookLike.titleLabel.text;
    
    NSString *theWholeUrl = [NSString stringWithFormat:@"https://graph.facebook.com/me/og.likes?object=%@&access_token=%@", urlToLikeFor, FBSession.activeSession.accessToken];
    NSLog(@"TheWholeUrl: %@", theWholeUrl);
    
    NSURL *facebookUrl = [NSURL URLWithString:theWholeUrl];
    
    NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:facebookUrl];
    [req setHTTPMethod:@"POST"];
    
    NSURLResponse *response;
    NSError *err;
    NSData *responseData = [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&err];
    NSString *content = [NSString stringWithUTF8String:[responseData bytes]];
    
    NSLog(@"responseData: %@", content);