我开发了一个在Facebook上具有共享功能的应用程序。该程序执行正常,但我有两个问题:
(i)如何将功能重定向到Facebook应用程序而不是浏览器中打开。 (ii)如何从设备相册中选择图片/视频并将其发布到Facebook中。
我无法找到解决这两个问题的适当指导。我在线尝试了一些教程,但似乎没什么用。有人可以指导我解决这个问题吗?谢谢。
ViewController.h:
#import <UIKit/UIKit.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
@interface ViewController : UIViewController
@end
ViewController.m:
#import "ViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL
URLWithString:@"https://www.facebook.com/FacebookDevelopers"];
FBSDKShareLinkContent *imageURL = [[FBSDKShareLinkContent alloc] init];
imageURL.imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Facebook_ Headquarters_Menlo_Park.jpg/2880px-Facebook_Headquarters_Menlo_Park.jpg"];
FBSDKShareButton *shareButton = [[FBSDKShareButton alloc] init];
shareButton.shareContent = content;
shareButton.shareContent = imageURL;
shareButton.center = self.view.center;
[self.view addSubview:shareButton];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
非常感谢任何帮助和建议。谢谢。
答案 0 :(得分:0)
它可以通过FABSharedialog实现或将视频转换为nsdata然后发布到Facebook。最新的facbook SDK是FBCorekit,facbook开发者网站提供所有信息和示例代码,可以帮助您。