Thoroughly stumped. I open an action sheet with a view controller in it, and when I click a button in the view controller to launch an SLComposeViewController, I get the error.
This is how I initialize the action sheet with the view controller in it:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:@"1",@"2",nil];
[actionSheet setBounds:CGRectMake(0,0, 320, 285)];
ExportVC*innerView = [[ExportVC alloc] initWithNibName:@"ExportVC" bundle:nil];
innerView.view.frame = actionSheet.bounds;
[actionSheet addSubview:innerView.view];
[actionSheet showFromTabBar:self.tabBarController.tabBar];
This is the ExportVC.h file:
#import <UIKit/UIKit.h>
#import <Social/Social.h>
@interface ExportVC : UIViewController{
}
- (IBAction)tweet:(id)sender;
@end
And here's the ExportVC.m file, where the IBAction launches the SLComposeViewController:
#import "ExportVC.h"
#import <Social/Social.h>
@interface ExportVC ()
@end
@implementation ExportVC
-(IBAction)tweet:(id)sender{
NSLog(@"button works");
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewController* tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"Hi"];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
}
The connections are fine. I don't have anything in the viewdidload of the ExportVC. Whenever I click the button attached to the "tweet" action however, I get the EXC Bad Access error. Any help would be appreciated.