I’m trying to call Sharekit with a UIButton, but when I tap the button running on my device, nothing happens.
This should be the relevant code in my view controller’s .h
#import "SHK.h"
#import "SHKFacebook.h"
@interface ViewController : UIViewController <CaptureManagerDelegate>
{
IBOutlet UIButton *upload;
}
@property (nonatomic, retain) IBOutlet UIButton *upload;
-(IBAction)buttonPressed:(id)sender;
And in my view controller’s .m (using code from example here http://gazapps.com/wp/2011/07/17/basic-sharekit-customization)
@synthesize upload;
-(IBAction)buttonPressed:(id)sender {
SHKItem *item;
NSURL *url = [NSURL URLWithString:@"http://www.gazapps.com"];
item = [SHKItem URL:url title:@"Checkout this site"];
[SHKFacebook shareItem:item];
}
-(void)dealloc
{
[upload release];
}
Besides trying to use a UIButton instead of UIBarButton, I’ve followed Sharekit’s install instructions to the letter. In my storyboard, I CTRL-dragged to the “first responder” and linked up my button to buttonPressed. I’m not getting any warnings or errors in xcode. But nothing happens when I tap the button.
You code seems fine. The problem is probably within the nib file. Check your connections again.
Are you doing anything else with your
upload(UIButton) property? You don’t need that Outlet at all, if you only want to trigger oneIBAction.You could put a breakpoint in your
buttonPressedmethod, to see if the connections are setup correctly.