[英]Posting to Facebook from Sharekit
我是sharekit的新手。 我正在尝试在Facebook上发布一个简单的文本:@“ Hello”,但这样做遇到了问题。.这将我带到登录页面。 我登录,然后关闭并返回主屏幕。 但是当我检查我的时间表时,它没有被添加。
我的ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
UIButton *btn;
IBOutlet UIToolbar *toolbar;
}
@property (nonatomic,strong) UIButton *btn;
- (IBAction)btnShareClicked:(id)sender;
@end
我的ViewController.m
#import "ViewController.h"
#import "SHK.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize btn;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
{
self.toolbarItems = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(btnShareClicked:)] ,
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],
nil
];
}
return self;
}
- (IBAction)btnShareClicked:(id)sender {
NSString *text = @"Hello";
SHKItem *item = [SHKItem text:text];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
// For Toolbar
//[actionSheet showFromToolbar:toolbar];
[actionSheet showInView:self.view];
}
@end
我已经包括了MessageUI,Security,SystemConfiguration框架...需要一些指导。
首先,您应该尝试检查您的应用程序中是否正在使用更新的ShareKit
API。如果未使用, ShareKit
SHareKIt站点添加该更新的API。
这是代码,请参见WhenEVer您想在Facebook上共享文本。
-(void)shareOnFacebook{
SHKItem * ietm1= [[SHKItem alloc] init];
[ietm1 setText:@"Hello"];
SHKFacebook *shkFacebook = [[SHKFacebook alloc] init]
[shkFacebook setSHKItem:item];
}
//see whether you have these Classes in your `ShareKit`.
希望对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.