I am thinking the issue is where you have the code you posted. You possibly have it in viewDidLoad
of your UIViewController
.
Do this in your UIViewController
:
-(void)viewDidAppear:(BOOL)animated
{
// assuming you are creating objectsToShare here or before this point
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
[self presentViewController:controller animated:YES completion:nil]
}
I believe the issue is that the view is not fully configured when you are trying to add your UIActivityViewController
.
I believe that the bounds and some other properties of the view are not yet properly configured in the viewDidLoad method, which results in a failure to display it.