I try to send an image with the help of shareKit without using an actionSheet but using my own button with
...
// --- add the mail button ------------------------------------
UIButton *buttonMail = [UIButton buttonWithType:UIButtonTypeCustom];
buttonMail.frame = CGRectMake( 0,0, btnW, btnH);
[buttonMail setImage:[UIImage imageNamed:@"btn_mail.png"] forState:UIControlStateNormal];
[buttonMail addTarget:self action:@selector(sendPerMailEvent:) forControlEvents:UIControlEventTouchUpInside];
...
// the sharekit image object
item = [SHKItem image:image title:@"Name of the image" ];
item.text = @"some text...";
[SHK setRootViewController:self.webView.window.rootViewController];
...
and
-(void)sendPerMailEvent:(id)sender {
[SHKMail shareItem:item];
[self closeScreenshotView];
}
but when I click the button xcode is throwing me an “EXC_BAD_ACCESS” error at the first line of shareItem():
+ (id)shareItem:(SHKItem *)i
{
[SHK pushOnFavorites:[self sharerId] forType:i.shareType]; // -> EXC_BAD_ACCESS
I am new to objective-c and the app is made with use of phonegap.
thnx!
now I found out: I needed to add a
[item retain], thats it.