iOS Facebook SDK - 在未设置隐私值设置为 SELF 的情况下发布到 friend 墙
<p><p>我想将我 friend 墙上的墙帖的隐私设置为 SELF。</p>
<p>所以只有他可以看到它,我知道这是可能的,因为有一个属性,但没有记录如何实现这一点。</p>
<p> <a href="https://developers.facebook.com/docs/graph-api/reference/post" rel="noreferrer noopener nofollow">https://developers.facebook.com/docs/graph-api/reference/post</a> </p>
<p>这是我使用的代码:</p>
<pre><code>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 = ];
if (!) {
// User clicked the Cancel button
NSLog(@"User canceled story publishing.");
} else {
// User clicked the Share button
NSString *msg = [NSString stringWithFormat:
@"Posted story, id: %@",
];
NSLog(@"%@", msg);
// Show the result in an alert
success();
}
}
}
}];
</code></pre>
<p>但是当我查看 GRAPH api 时,它会说:</p>
<pre><code>"privacy": {
"value": ""
},
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>试试这个。可能是这个帮助。</p>
<pre><code>NSDictionary *privacyDict = [ initWithObjectsAndKeys:
@"SELF",@"value",
nil];
SBJSON *jsonWriter = [ init];
NSString *privacyJSONStr = ;
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"my message", @"message",
privacyJSONStr, @"privacy",
nil];
</code></pre>
<p>根据你的使用设置字典privacyDict的objectofkey<strong>(value,friends,networks,allow,deny)</strong></p>
<pre><code>NSDictionary *privacyDict = [ initWithObjectsAndKeys:
@"CUSTOM",@"value",
@"SOME_FRIENDS",@"friends",
@"",@"allow",
nil];
</code></pre></p>
<p style="font-size: 20px;">关于iOS Facebook SDK - 在未设置隐私值设置为 SELF 的情况下发布到 friend 墙,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23220953/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23220953/
</a>
</p>
页:
[1]