どこでも検索しましたが、それを行う方法のヒントが1つも得られませんでした....コードもいくつか取得しましたが、機能していません...それを行うためのチュートリアルまたはサンプルコードを誰かに提案してもらえますか!!! 事前に感謝します私は次のコードを試しています::
-(void)inviteFriend:(CustomButton *)sender
{
NSString *str=[NSString stringWithFormat:@"%@/feed",sender.inviteUserId];
if (FBSession.activeSession.isOpen)
{
//UIImage *image = [UIImage imageNamed:@"testImage.png"];
hudApp = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hudApp.labelText = @"Page Sharing...";
[self performSelector:@selector(timeout:) withObject:nil afterDelay:60*5];
// NSString *fbMessage = [NSString stringWithFormat:@"test"];
NSString *fbMessage = @"hello testing";
NSMutableDictionary* params=[NSDictionary dictionaryWithObjectsAndKeys:fbMessage, @"message", FBSession.activeSession.accessToken, @"access_token", nil];
NSLog(@"feed::%@",str);
[FBRequestConnection startWithGraphPath:str
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result,NSError *error) {
NSLog(@"result::%@",result);
if(error)
{
NSLog(@"fail : %@",error.localizedDescription);
hudApp.labelText = [NSString stringWithFormat:@"%@",error.localizedDescription];
}
else
{
NSLog(@"Success facebook post");
hudApp.labelText = [NSString stringWithFormat:@"Success"];
// txtView.text = @"success";
NSLog(@"success");
}
hudApp.mode = MBProgressHUDModeCustomView;
[self performSelector:@selector(dismissHUD:) withObject:nil afterDelay:1.0];
}];
}
else
{
NSArray *permissions = [NSArray arrayWithObject:@"publish_stream"];
[FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES
completionHandler:^(FBSession *session, FBSessionState state,NSError *error) {
NSLog(@"session.permissions ? : %@", session.permissions);
[self sessionDoneForPageShare:session state:state error:error withuserid:str];
}
];
}
}
-(void)sessionDoneForPageShare:(FBSession *)session state:(FBSessionState)state error:(NSError *)error withuserid :(NSString *)usreid
{
//UIImage *image = [UIImage imageNamed:@"testImage.png"];
NSLog(@"feed::%@",usreid);
hudApp = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hudApp.labelText = @"Page Sharing...";
[self performSelector:@selector(timeout:) withObject:nil afterDelay:60*5];
//NSString *fbMessage = [NSString stringWithFormat:@"test"];
NSString *fbMessage = @"hello testing";
NSLog(@"State : %d **** Facebook Message : %@",state,fbMessage);
// NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys: fbMessage, @"message", nil];
NSMutableDictionary* params=[NSDictionary dictionaryWithObjectsAndKeys:fbMessage, @"message", FBSession.activeSession.accessToken, @"access_token", nil];
[FBRequestConnection startWithGraphPath:usreid
parameters:params
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(error)
{
NSLog(@"fail : %@",error.localizedDescription);
// txtView.text = [NSString stringWithFormat:@"%@",error.localizedDescription];
NSLog(@"%@",[NSString stringWithFormat:@"%@",error.localizedDescription]);
hudApp.labelText = [NSString stringWithFormat:@"%@",error.localizedDescription];
}
else
{
NSLog(@"Success facebook post");
hudApp.labelText = [NSString stringWithFormat:@"Success"];
//txtView.text = @"success";
NSLog(@"success");
}
hudApp.mode = MBProgressHUDModeCustomView;
[self performSelector:@selector(dismissHUD:) withObject:nil afterDelay:1.0];
}];
}