2011-03-22 47 views
0

目前I M開發iPhone應用程序(謝謝連接)流,iphone FBconnect - 發佈多個朋友的

是否可以發佈消息發送到多個朋友的牆壁?目前,我可以使用「PUBLISH STREAM」在單個朋友牆上發送消息。

SO使用發佈流可以在多個朋友的牆上一次發送消息嗎?

回答

1

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

檢查例如:

這些Fb的委託方法添加到類。

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

獲取朋友的UID:登錄後,在得到朋友的細節和在數組「的UID」

- (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); 
} 

發佈的UID存儲的朋友所有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++; 
    } 
}