Search code examples
facebookfacebook-graph-apiiphone-sdk-3.0facebook-ios-sdk

Publish on wall (status, link, video etc) with security


I am using facebook-ios-sdk. I want to publish on FaceBook wall with security (status, link, video, whatever else), so that only specific friends can see the update.

How can I do that?


Solution

  • Check the privacy arguments in this link http://developers.facebook.com/docs/reference/api/post/

    and code is like this. this code is just for status update

    NSDictionary *privacyDict = [[NSDictionary alloc] initWithObjectsAndKeys:
                       @"SELF",@"value",
                       nil];
    SBJSON *jsonWriter = [[SBJSON new] autorelease];
    NSString *privacyJSONStr = [jsonWriter stringWithObject:privacyDict];
    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                       @"my message", @"message",
                       privacyJSONStr, @"privacy",
                       nil];
    

    Set the objectofkey (value,friends,networks,allow,deny) of dictionary privacyDict according to your use

    NSDictionary *privacyDict = [[NSDictionary alloc] initWithObjectsAndKeys:
                       @"CUSTOM",@"value",
                       @"SOME_FRIENDS",@"friends",
                       @"[comma separated friends id]",@"allow",
                       nil];