iOS Facebook SDK-未设置隐私值设置为SELF的好友墙帖子
我想将我朋友墙上的墙贴的隐私设置为SELF 所以,只有他能看到,我知道这是可能的,因为有一个属性,但没有记录如何实现这一点 这是我使用的代码:iOS Facebook SDK-未设置隐私值设置为SELF的好友墙帖子,ios,facebook-graph-api,facebook-ios-sdk,facebook-sdk-3.0,fbwebdialogs,Ios,Facebook Graph Api,Facebook Ios Sdk,Facebook Sdk 3.0,Fbwebdialogs,我想将我朋友墙上的墙贴的隐私设置为SELF 所以,只有他能看到,我知道这是可能的,因为有一个属性,但没有记录如何实现这一点 这是我使用的代码: NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: toStr, @"to", @"{'value': 'SELF'}", @"privacy", @"Facebook SDK for iOS", @"na
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
toStr, @"to",
@"{'value': 'SELF'}", @"privacy",
@"Facebook SDK for iOS", @"name",
@"Build great social apps and get more installs.", @"caption",
@"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", @"description",
@"https://developers.facebook.com/ios", @"link",
@"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", @"picture",
nil];
//NSLog(@"params %@", params);
[FBWebDialogs presentFeedDialogModallyWithSession:nil
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or publishing a story.
NSLog(@"Error publishing story.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled story publishing.");
} else {
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"]) {
// User clicked the Cancel button
NSLog(@"User canceled story publishing.");
} else {
// User clicked the Share button
NSString *msg = [NSString stringWithFormat:
@"Posted story, id: %@",
[urlParams valueForKey:@"post_id"]];
NSLog(@"%@", msg);
// Show the result in an alert
success();
}
}
}
}];
但当我查看GRAPH api时,它会说:
"privacy": {
"value": ""
},
试试这个。也许这有帮助
NSDictionary *privacyDict = [[NSDictionary alloc] initWithObjectsAndKeys:
@"SELF",@"value",
nil];
SBJSON *jsonWriter = [[SBJSON alloc] init];
NSString *privacyJSONStr = [jsonWriter stringWithObject:privacyDict];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"my message", @"message",
privacyJSONStr, @"privacy",
nil];
根据您的使用情况设置dictionary privacyDict的objectofkey(值、朋友、网络、允许、拒绝)
NSDictionary *privacyDict = [[NSDictionary alloc] initWithObjectsAndKeys:
@"CUSTOM",@"value",
@"SOME_FRIENDS",@"friends",
@"[comma separated friends id]",@"allow",
nil];
如何导入SBJSON?