0

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

laksh
  • 2,209
  • 6
  • 21
  • 25

1 Answers1

1

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.

Kamar Shad
  • 6,089
  • 1
  • 29
  • 56
  • firstly, when i started, i downloaded the sharekit from the website you gave and these are working based on the latest sharekit codes..next i added you code, and it is giving me this error:No visible interface for SHKFacebook declares the selector setSHKItem. – laksh Nov 17 '12 at 14:48
  • @laksh do you have these class in your ShareKit API, If OS then you should use My Code Rather Than Your. – Kamar Shad Nov 17 '12 at 14:50
  • i have them under Sharekit->Sharers->Services->Facebook – laksh Nov 17 '12 at 14:54
  • @you need to call my code whenever you want to share some text over the Facebook. have you done the same. i am sure that would work .... – Kamar Shad Nov 17 '12 at 16:36
  • SHKItem * item= [[SHKItem alloc] init]; [item setText:@"Hello"]; [SHKFacebook shareItem:item]; I use this code in my btnShareClicked method, but it doesn't post to my Facebook timeline... – laksh Nov 17 '12 at 16:38
  • Dude @laksh i am using the same code bfor sharing text over to the Facebook and it's working.... – Kamar Shad Nov 17 '12 at 16:40
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/19682/discussion-between-laksh-and-ios-deveoper) – laksh Nov 17 '12 at 16:42
  • hi what changes did u make to the files.. can tell me?? – laksh Nov 19 '12 at 11:02