0

I´m trying to use the following code in my app to get the uiactivityviewcontroller, and it works if I set up a round rect button, but not with a UIBarButtonItem? Am I missing something really simple here?

- (IBAction)shareIt:(id)sender {
    NSArray *activityItems;

    activityItems = @[_textView.text];


    UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    [self presentViewController:activityController animated:YES completion:nil];

}
Undo
  • 25,519
  • 37
  • 106
  • 129
Pierre
  • 160
  • 2
  • 11

1 Answers1

0

I'm guessing (read: I'm sure) that this is happening because you didn't hook up the action to the barButtonItem correctly in code. If you are making it in code, you can use this:

UIBarButtonItem *bBI = ...; //get it
[bBI setTarget:self];
[bBI setAction:@selector(shareIt:)];
Undo
  • 25,519
  • 37
  • 106
  • 129