I intended to post (Image or String or Link) in Facebook. When i tried to post with the following code it is only posting in my wall, not showing in my friends wall.
Permission :
"read_stream","publish_stream","email","user_birthday","friends_about_me","friends_activities","friends_likes".
- (IBAction)fblogin:(id)sender {
AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
getdelegate.facebook.sessionDelegate=self;
Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus internetStatus = [reachability currentReachabilityStatus];
if (internetStatus != NotReachable) {
if([getdelegate.facebook isSessionValid])
{
NSLog(@"User already logined with facebook");
}
else
{
[getdelegate.facebook authorize:[NSArray arrayWithObjects:@"read_stream",@"publish_stream",@"email",@"user_birthday",@"friends_about_me",@"friends_activities",@"friends_likes",nil]];
}
}
else
{
NSLog(@"No Internet Connection");
}
}
- (void)fbDidLogin
{
AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
[getdelegate.facebook requestWithGraphPath:@"me" andDelegate:self];
}
- (void) request:(FBRequest*)request didLoad:(id)result
{
AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
if ([result isKindOfClass:[NSDictionary class]])
{
}
}
- (IBAction)Sharebutton:(id)sender
{
AppDelegate *getdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
NSLog(@"TOKEN:%@",getdelegate.facebook.accessToken);
NSURL *url = [NSURL URLWithString:@"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img= [[UIImage alloc] initWithData:data];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:img,@"picture",@"http://www.google.com",@"link",@"Message text",@"message",nil];
[[getdelegate facebook] requestWithGraphPath:@"me/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
}
What have i done wrong?
Read this link changed in Facebook Methods
https://developers.facebook.com/roadmap/completed-changes/
IdOfFriend/Feed method wont work anymore
Read it for more help:
[[getdelegate facebook] requestWithGraphPath:@"me/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
instead of "me/feed" you have to provide the facebook id of the friend on whose wall you want to share.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.