2012-11-17 52 views
0

我新手sharekit。我試圖發佈一個簡單的文本:@「你好」Facebook,但面臨問題這樣做..它使我到登錄頁面。我登錄後關閉並返回主屏幕。但是,當我檢查我的時間表,所以不加..發佈至Facebook從Sharekit

我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,安全,SystemConfiguration框架。 ..需要一些指導這個..

回答

1

首先,你應該嘗試檢查是否正在使用您的Application.if更新ShareKit API不然後添加UPD來自The SHareKIt網站。

Here is Link for The ShareKit Site

這裏是代碼中看到,調用,只要你想分享的文本在使用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`. 

我希望這對你有幫助。

+0

首先,當我開始,我下載了你給這些正在基於最新sharekit codes..next我加你的代碼,它給我這個錯誤的網站sharekit:爲SHKFacebook無可見接口聲明選擇器setSHKItem。 – laksh

+0

@laksh你在ShareKit API中是否有這些類,如果是OS,那麼你應該使用我的代碼而不是你的。 – Kamarshad

+0

我讓他們下Sharekit-> Sharers->服務 - > Facebook的 – laksh