• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

iOS Facebook SDK - 在未设置隐私值设置为 SELF 的情况下发布到 friend 墙

[复制链接]
菜鸟教程小白 发表于 2022-12-12 21:48:06 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我想将我 friend 墙上的墙帖的隐私设置为 SELF。

所以只有他可以看到它,我知道这是可能的,因为有一个属性,但没有记录如何实现这一点。

https://developers.facebook.com/docs/graph-api/reference/post

这是我使用的代码:

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:
                                      @"osted story, id: %@",
                                      [urlParams valueForKey"post_id"]];
                     NSLog(@"%@", msg);
                     // Show the result in an alert
                     success();
                 }
             }
         }
     }];

但是当我查看 GRAPH api 时,它会说:

"privacy": {
          "value": ""
        }, 



Best Answer-推荐答案


试试这个。可能是这个帮助。

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];

根据你的使用设置字典privacyDict的objectofkey(value,friends,networks,allow,deny)

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

关于iOS Facebook SDK - 在未设置隐私值设置为 SELF 的情况下发布到 friend 墙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23220953/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap