Facebook SDK:帖子到墙只有我可见的测试用途?

时间:2012-04-17 07:49:23

标签: iphone ios facebook ipad

当我使用适用于iOS的Facebook SDK测试我的代码时,我所有朋友都可以看到我的所有帖子。 出于我的所有测试目的,我希望能够限制发布。 在Facebook页面/偏好/应用程序中,我可以设置“在我自己的名字内发布”的可见性。当我将其更改为“仅我”时,将新内容发布到我的墙上不再有效( - >“请求didFailWithError”)。

此外,在将新版本部署到iPad后,此首选项将重置为默认值。

因此我想问你,是否有能力直接在我的iOS应用程序中设置它? 谢谢你的帮助。

编辑:

无法完成。当我输出我的请求时,我得到了这个NSLog:

> Request didLoad: {
>     actions =     (
>                 {
>             link = "https://www.facebook.com/1608527xxx/posts/3278287008xxx";
>             name = Comment;
>         },
>                 {
>             link = "https://www.facebook.com/1608527xxx/posts/3278287008xxx";
>             name = Like;
>         }
>     );
>     application =     {
>         id = 274053732670xxx;
>         name = "iPad App";
>     };
>     comments =     {
>         count = 0;
>     };
>     "created_time" = "2012-04-17T11:12:46+0000";
>     from =     {
>         id = 160x527xxx;
>         name = "MyName";
>     };
>     icon = "https://s-static.ak.facebook.com/rsrc.php/v1/yzwe/r/StEh3RhPvjk.gif";
>     id = "1xx08527xxx_3278287008xxx";
>     link = "https://www.facebook.com/photo.php?fxxxxxxxx";
>     message = "test caption";
>     name = "iPad App Photos";
>     "object_id" = 32782867xxxxx;
>     picture = "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/xxxxxx70_s.jpg";
>     privacy =     {
>         description = Friends;
>         value = "ALL_FRIENDS";
>     };
>     type = photo;
>     "updated_time" = "2012-04-17T11:12:46+0000";

-(void) postPhoto:(UIButton*)button{

    UIImage *uploadImage = [UIImage imageNamed:@"testImage"];

    NSDictionary *dictPrivacy = [NSDictionary dictionaryWithObjectsAndKeys:@"CUSTOM",@"value", @"SELF", @"friends", nil];

    //SBJSON* jsonWriter = [[SBJSON alloc] init];
    SBJSON* jsonWriter = [SBJSON new];
    NSString* privacyJSONStr =  [jsonWriter stringWithObject:dictPrivacy];
    NSLog(@"stringPrivacy: %@", privacyJSONStr);

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   uploadImage, @"source", 
                                   @"test caption", @"message", 
                                   privacyJSONStr, @"privacy",
                                   nil];

    [self.facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:(id)self];
    }

对此有何帮助? 谢谢 (许可状态:)

  

NSArray * permissions = [[NSArray alloc] initWithObjects:   @“read_stream”,@“publish_stream”,@“user_photos”,nil];

3 个答案:

答案 0 :(得分:2)

我通常只在facebook上使用没有朋友的测试用户。适合我!

答案 1 :(得分:1)

您可以为iOS应用中的每个帖子设置隐私。请在此页面中注明关键字“privacy”。

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

enter image description here

答案 2 :(得分:1)

有一个用于创建测试用户的API,Facebook每个应用最多支持500个测试用户:http://developers.facebook.com/docs/test_users/