I want to post some photos Or Link on user Facebook wall without using FBSDKShareDialog . I am already post With using the FBSDKSharePhoto And FBSDKShareDialog default dialog from facebook. for that I do the below code
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.imgView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:(id)self];
But, this code open the Default FB dialog. So, how can I directly post the link and photos ON user's wall.
You can use SLComposeViewController of default iOS Social Framework
#import <Social/Social.h>
- (IBAction)postToFacebook:(id)sender {
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Post from my iPhone app"];
[controller addURL:[NSURL URLWithString:@"http://www.yourlink.com"]];
[controller addImage:[UIImage imageNamed:@"facebook-image.jpg"]];
[controller setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(@"Post Canceled");
break;
case SLComposeViewControllerResultDone:
NSLog(@"Post Sucessful");
break;
default:
break;
}
}];
[self presentViewController:controller animated:YES completion:Nil];
}
}
Documentation for Facebook Sharing. : https://developers.facebook.com/docs/sharing/ios
Through Graph API :
1) Post image on facebook wall using graph api iphone sdk
2) Photo Upload to own wall via iOS Graph API with user's location
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.