I want to share image using UIActivityViewController
.
This is my code.
- (IBAction)shareBUttonClick:(id)sender
{
for(int i=0; i<[self.imagesDataArray count];i++)
{
[imageView sd_setImageWithURL:[NSURL URLWithString:[self.imagesDataArray objectAtIndex:i]] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
NSArray *postItems=@[imageView];
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:postItems applicationActivities:nil];
//if iPhone
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
[self presentViewController:controller animated:YES completion:nil];
}
//if iPad
else
{
// Change Rect to position Popover
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:controller];
[popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
}
but, its giving me null(UIActivityViewController open in real device but sharing not there)
Please help me.