簡體   English   中英

iPhone FBconnect-發布多個朋友的流

[英]iphone FBconnect - publish stream for multiple friend's

目前我正在使用iPhone應用程序(facebook連接),

是否可以將消息發布到多個朋友的牆上? 目前,我可以使用“發布流”在單個朋友牆上發送消息。

因此,使用發布流可以一次在多個朋友的牆上發送消息?

我猜沒有這種功能。 但是你可以做到的。

檢查示例:

這些是Fb委托方法添加到類中。

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

獲取朋友UID:登錄后獲取朋友詳細信息,並將朋友UIds存儲在數組“ 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++;
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM