在iOS应用程序上发送给朋友的FB消息

时间:2013-07-19 07:23:19

标签: ios facebook

我想在我的iOS应用上向Facebook好友发送消息。但我无法发送。 我的代码是

NSMutableDictionary *postTest = [[NSMutableDictionary alloc]init];
[postTest setObject:@"Your message" forKey:@"message"];
[postTest setObject:@"" forKey:@"picture"];
[postTest setObject:@"" forKey:@"name"];
[postTest setObject:FACEBOOK_APP_ID forKey:@"app_id"];
NSString *userFBID =[NSString stringWithFormat:@"%@",@"1649291866"];

[FBRequestConnection startWithGraphPath:
    [NSString stringWithFormat:
        @"%@/feed?access_token=%@",userFBID,[FBSession activeSession].accessToken]
parameters:postTest
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
NSDictionary * result,
NSError *error) {
    if (error) {
    //[self hideHUD];
    NSLog(@"Error: %@", [error localizedDescription]);
    }
    else
    {// Success}

    }];

[postTest release];

任何人都可以帮助我

0 个答案:

没有答案