从Sharekit发布到Facebook [英] Posting to Facebook from Sharekit

查看:117
本文介绍了从Sharekit发布到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是newbie to sharekit。我试图发布一个简单的文本:@你好到Facebook,但面临的问题这样做..它导致我的登录页面。我登录后关闭并返回主屏幕。但是,当我查看我的时间表时,它没有添加..



我的ViewController.h

  #import< UIKit / UIKit.h> 

@interface ViewController:UIViewController {
UIButton * btn;
IBOutlet UIToolbar *工具栏;
}

@property(nonatomic,strong)UIButton * btn;
- (IBAction)btnShareClicked:(id)sender;

@end

我的ViewController.m

  #importViewController.h
#importSHK.h

@interface ViewController()

@end

@implementation ViewController
@synthesize btn;

- (void)viewDidLoad
{
[super viewDidLoad];
//加载视图后通常从一个笔尖进行任何其他设置。
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
//处理可以重新创建的任何资源。
}
- (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 :自我动作:@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 = [SHKctionSheet actionSheetForItem:item];


//工具栏
// [actionSheet showFromToolbar:toolbar];


[actionSheet showInView:self.view];

}
@end

我已经包括了MessageUI,安全,系统配置框架...需要一些指导。

解决方案

首先你应该尝试检查你是否使用更新 ShareKit 您的Application.if中的API,然后不要添加从SHareKIt网站更新的一个。



这是ShareKit网站的链接



这里是代码见,Called WhenEVer你想在Facebook上共享文本。

   - (void)shareOnFacebook {
SHKItem * ietm1 = [[SHKItem alloc] init];
[ietm1 setText:@Hello];

SHKFacebook * shkFacebook = [[SHKFacebook alloc] init]
[shkFacebook setSHKItem:item];
}
//查看你的ShareKit中是否有这些类。

希望对您有帮助。


I am newbie to sharekit. I am trying to post a simple text: @"Hello" to Facebook, but facing problems in doing so.. It leads me to the login page. I login and then it closes and comes back to the main screen. But when i check my timeline, it is not added..

My ViewController.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController{
    UIButton *btn;
    IBOutlet UIToolbar *toolbar;
}

@property (nonatomic,strong) UIButton *btn;
- (IBAction)btnShareClicked:(id)sender;

@end

My 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

I have included the MessageUI,Security,SystemConfiguration frameworks... Need some guidance on this..

解决方案

First You should try to Check whether you are using the updated ShareKit API in Your Application.if Not then Add That Updated One from The SHareKIt Sites.

Here is Link for The ShareKit Site

Here Is the Code See,Called WhenEVer You want to share text Over the 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`.

I hope it may Helpful to you.

这篇关于从Sharekit发布到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆