如何在iPhone的Facebook朋友墙上发布消息

问题描述 投票:2回答:3

如何使用NEWFacebook SDK选择好友的target_id在Facebook好友的墙上发布消息。

iphone objective-c ipad
3个回答
5
投票
NSMutableDictionary *variables = [NSMutableDictionary dictionaryWithCapacity:4];
[variables setObject:[NSString stringWithFormat:@"Hi."] forKey:@"message"];
[variables setObject:@"http://icon.png" forKey:@"picture"];       //http://tinyurl.com/45xy4kw
[variables setObject:@"Create post" forKey:@"name"];
[variables setObject:@"Write description." forKey:@"description"];

[_facebook requestWithGraphPath:[NSString stringWithFormat:@"/%@/feed",facebook_user_id] 
                      andParams:variables 
                  andHttpMethod:@"POST"
                    andDelegate:self];

0
投票
NSMutableDictionary *参数= [NSMutableDictionary dictionaryWithObjectsAndKeys:@“ https://developers.facebook.com/docs/reference/dialogs/”,@“链接”,@“ Facebook对话框”,@“名称”,@“参考文档”,@“标题”,@“使用对话框与用户互动。”,@“说明”,@“ Facebook对话框非常简单!”,@“消息”,零];// [facebook requestWithGraphPath:@“ me / feed” andParams:params andDelegate:self];// [facebook requestWithMethodName:@“ me / feed” andParams:params andHttpMethod:@“ POST” andDelegate:self];[facebook requestWithGraphPath:@“ me / feed” andParams:params andHttpMethod:@“ POST” andDelegate:self];

0
投票

检查委托方法

-(无效)fbDidLogin{NSUserDefaults *默认值= [NSUserDefaults standardUserDefaults];[默认为setObject:[facebook accessToken] forKey:@“ FBAccessTokenKey”];[默认为setObject:[facebook expirationDate] forKey:@“ FBExpirationDateKey”];[默认同步];[facebook requestWithGraphPath:@“ me / picture” andDelegate:self];NSLog(@“使用:%@%@登录成功”,facebook.accessToken,facebook.expirationDate);}-(无效)fbDidLogout{NSUserDefaults *默认值= [NSUserDefaults standardUserDefaults];if([默认值objectForKey:@“ FBAccessTokenKey”] && [默认值objectForKey:@“ FBExpirationDateKey”]){[默认为removeObjectForKey:@“ FBAccessTokenKey”];[默认为removeObjectForKey:@“ FBExpirationDateKey”];[默认同步];}NSLog(@“注销成功”);}-(无效)请求:(FBRequest *)请求didLoad:(id)结果{如果(c == 0){NSData * data = [NSData dataWithData:(NSData *)result];UIImage * profilePic = [[[UIImage alloc] initWithData:data]自动释放];image1.image = profilePic;[self postWall];// NSLog(@“响应为%@”,结果);// NSString * email = [结果objectForKey:@“名称”];// NSString * userFbId = [结果objectForKey:@“ id”];// NSLog(@“%@”,email);// NSLog(@“%@”,userFbId);c = 1;}其他{NSLog(@“%@”,结果);NSLog(@“ posted !!”);}}-(void)请求:(FBRequest *)请求didFailWithError:(NSError *)错误{NSLog(@“失败,错误:%@”,[错误localizedDescription]);}
© www.soinside.com 2019 - 2024. All rights reserved.