Nat
Nat

Reputation: 12948

Social.framework Facebook possibilities

I can't find easy answers on the web. I know that Social.framework is great for making things less complicated and less buggy. However I tried to implement like and failed - I don't think it is possible using only Social.framework. Now I'm trying to get some posts image and add a comment to it, it's also complicated, I'm not sure if possible. It seems all more complicated stuff you used to do via opengraph isn't possible with Social.framework.

Maybe there is a way to mix Social.framework with FacebookSDK and log user via the first framework and get object via 2nd with opengraph?

Can anyone write if these actions are possible? Or how to know what is possible/impossible with Social.framework? I consider mainly Facebook.

-- edit --

An example would be:

NSURL *likeUrl = [NSURL URLWithString:@"https://graph.facebook.com/me/og.likes"];
NSURL *objectUrl = [NSURL URLWithString:@"object_with_tags_to_like"];
NSDictionary *parameters = @{ACFacebookAppIdKey: @"111",
                             @"object": objectUrl};
SLRequest *facebookRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook 
                                        requestMethod:SLRequestMethodPOST 
                                        URL:likeUrl 
                                        parameters:parameters];
facebookRequest.account = facebookAccount;

[facebookRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
    // set a breakpoint here, we're getting in resp: 
    // "Www-Authenticate" = "OAuth \"Facebook Platform\" \"invalid_request\" \
    // "The action you're trying to publish is invalid because it does not specify any reference objects. 
    // At least one of the following properties must be specified: object.\"";
}];

Here we can see that passing object isn't easy. With FacebookSDK you'd simply:

NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];
action[@"object"] = urlAddress;
[FBRequestConnection startForPostWithGraphPath:@"me/og.likes" 
                     graphObject:action 
                     completionHandler:nil];

But here you can't create FBGraphObject. What to use instead?

Upvotes: 0

Views: 221

Answers (1)

Andy
Andy

Reputation: 479

Honestly the Facebook SDK is quit powerful and simple to use. It allows you much more functionality in terms of Liking and Commenting so I would recommend you move towards that. The SocialFramework is limited, it is mainly used for sending a quick post (using their template, -> no customization) and quick login.

I have successfully done all of what you are asking for using solely the Facebook SDK.

Upvotes: 1

Related Questions