【问题标题】:Posting to Facebook from Sharekit从 Sharekit 发布到 Facebook
【发布时间】:2012-11-06 01:18:31
【问题描述】:

我是 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 框架......需要一些指导......

【问题讨论】:

    标签: iphone ios facebook ios6 sharekit


    【解决方案1】:

    首先,您应该尝试检查您的应用程序中是否使用了更新的ShareKit API。如果没有,则从 SHareKIt 站点添加更新的 API。

    Here is Link for The ShareKit Site

    这是代码 See,当你想在 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`.
    

    希望对你有帮助。

    【讨论】:

    • 首先,当我开始时,我从您提供的网站下载了共享工具包,这些是基于最新的共享工具包代码工作的。接下来我添加了您的代码,它给了我这个错误:否SHKFacebook 的可见界面声明了选择器 setSHKItem。
    • @laksh 你的 ShareKit API 中有这些类吗?如果是操作系统,那么你应该使用我的代码而不是你的。
    • 我把它们放在 Sharekit->Sharers->Services->Facebook
    • @你需要在 Facebook 上分享一些文字时调用我的代码。你有没有做同样的事情。我相信这会奏效....
    • SHKItem * item= [[SHKItem alloc] init]; [项目集文本:@“你好”]; [SHKFacebook shareItem:item];我在我的 btnShareClicked 方法中使用了这段代码,但它没有发布到我的 Facebook 时间线......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-15
    • 1970-01-01
    • 2011-03-28
    • 1970-01-01
    • 2012-08-11
    相关资源
    最近更新 更多