我正在尝试在我的墙贴上标记我的一些朋友而且我发送了以下参数,但这个帖子发布到我的墙上我提供的FB ID不会附在帖子上...
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Test 2 ",@"message",
@"100004311843201 , 1039844409", @"to",
@"http://www.google.com", @"link",
@"Test", @"name",
nil];
[self.appDelegate.facebook requestWithGraphPath:@"me/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];
感谢任何帮助...
答案 0 :(得分:0)
要以ur fb状态标记朋友..您需要使用FBFriendPickerViewController和使用FBPlacePickerViewController的“place id”来获取朋友的“facebook id”。 以下代码可以帮助您。
NSString *apiPath = nil;
apiPath = @"me/feed";
if(![self.selectedPlaceID isEqualToString:@""]) {
[params setObject:_selectedPlaceID forKey:@"place"];
}
NSString *tag = nil;
if(mSelectedFriends != nil){
for (NSDictionary *user in mSelectedFriends) {
tag = [[NSString alloc] initWithFormat:@"%@",[user objectForKey:@"id"] ];
[tags addObject:tag];
}
NSString *friendIdsSeparation=[tags componentsJoinedByString:@","];
NSString *friendIds = [[NSString alloc] initWithFormat:@"[%@]",friendIdsSeparation ];
[params setObject:friendIds forKey:@"tags"];
}
FBRequest *request = [[[FBRequest alloc] initWithSession:_fbSession graphPath:apiPath parameters:params HTTPMethod:@"POST"] autorelease];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
[SVProgressHUD dismiss];
if (error) {
NSLog(@"Error ===== %@",error.description);
if (_delegate != nil) {
[_delegate facebookConnectFail:error requestType:FBRequestTypePostOnWall];
}else{
NSLog(@"Error ===== %@",error.description);
}
}else{
if (_delegate != nil) {
[_delegate faceboookConnectSuccess:self requestType:FBRequestTypePostOnWall];
}
}