【问题标题】:iphone FBconnect - publish stream for multiple friend'siphone FBconnect - 为多个朋友发布流
【发布时间】:2011-03-22 13:47:03
【问题描述】:

目前我正在开发 iphone 应用程序(facebook 连接),

是否可以将消息发布到多个朋友墙?目前我可以使用“PUBLISH STREAM”在单身朋友墙上发送消息。

所以使用发布流可以一次在多个朋友的墙上发送消息吗??

【问题讨论】:

    标签: iphone facebook fbconnect


    【解决方案1】:

    我猜没有这样的功能。但你可以做到。

    查看示例:

    这些是添加到类的 Fb 委托方法。

    - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)response {
        NSLog(@"received response");
    };
    

    获取好友UID:登录后获取好友详细信息并将好友UId存储在数组'uids'中

    - (void)request:(FBRequest *)request didLoad:(id)result {   
        if([result isKindOfClass:[NSDictionary class]]) {
            NSLog(@"dictionary");
            result=[result objectForKey:@"data"];
            if ([result isKindOfClass:[NSArray class]]) {   
                for(int i=0;i<[result count];i++){
                    NSDictionary *result2=[result objectAtIndex:i];
                    NSString *result1=[result2 objectForKey:@"id"];
                    NSLog(@"uid:%@",result1);
                    [uids addObject:result1];
                }       
            }
        }
    }
    - (void)request:(FBRequest *)request didLoadRawResponse:(NSData *)data
    {
        NSString *dataresponse=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"data is :%@",dataresponse);
    }
    

    发布给所有 FB 朋友:

    Itterate the post till [uids count];
    - (void)conncetToFriends:(id)sender {
        static int ij=0;
        NSMutableDictionary* params1 = [NSMutableDictionary dictionaryWithObjectsAndKeys:appId, @"api_key", @"Happy Holi", @"message", @"http://www.holifestival.org/holi-festival.html", @"link", @"http://www.onthegotours.com/blog/wp-content/uploads/2010/08/Holi-Festival.png", @"picture", @"Wanna Kno abt HOLI.. Check this...", @"name", @"Wish u 'n' Ur Family, a Colourful day...", @"description", nil];
        NSLog(@"uid count:%i",[uids count]);
        for(int i=0;i<[uids count];i++) {
            NSString *path=[[NSString alloc]initWithFormat:@"%@/feed",[uids objectAtIndex:i]];
            NSLog(@"i value:%i",ij);
            //[facebook dialog:@"me/feed" andParams:params1 andDelegate:self];
            [facebook requestWithGraphPath:path andParams:params1 andHttpMethod:@"POST" andDelegate:self];
            ij++;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多