iphone - 从 Sharekit 发布到 Facebook

标签 iphone ios facebook ios6 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 站点添加更新的 API。

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`.

希望对您有帮助。

关于iphone - 从 Sharekit 发布到 Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13431432/

相关文章:

iphone - dispatch_semaphore_wait 停止 iPhone APP 中的所有线程

ios - UIImage 在滚动之前不会显示在 TableView 单元格中

Facebook 页面 - 如何在图 api 上为用户获取访问 token 权限 - "perms"?

iphone - 比较字符串 Objective C

ios - 更改facebook iOS登录和注销按钮的背景

ios - UITextField 可以发送它的 Action 两次。这是一个 iOS 错误,还是我犯了一个错误?

ios - iCloud Drive 可以在 watchOS 上使用吗?

javascript - 使用 Facebook JS SDK 和 Rails 循环登录

Facebook 点赞按钮未显示

iphone - 在 OSX 10.6 中以编程方式与连接的 iOS/iPod 进行交互