My console throws this error when attaching an image to send via Facebook:
The same image works fine while sending to Twitter also via UIActivity. The Facebook image doesn't work on the device or the simulator, and shows a safari type icon.
Pic of issue:
I appreciate any help offered.
EDIT: The issue only happens when I attach a url along with the image.
Here is my code:
Code:
<Error>: CGImageCreate: invalid image size: 0 x 0.
The same image works fine while sending to Twitter also via UIActivity. The Facebook image doesn't work on the device or the simulator, and shows a safari type icon.
Pic of issue:

I appreciate any help offered.
EDIT: The issue only happens when I attach a url along with the image.
Here is my code:
Code:
- (void)test
{
NSString *textItem = @"Check out the app:";
UIImage *imageToShare = [UIImage imageNamed:@"test.png"];
NSURL *url = [NSURL URLWithString:@"http://applinkhere"];
CustomProvider *customProvider =
[[CustomProvider alloc]init];
NSArray *items = [NSArray arrayWithObjects:customProvider,textItem,imageToShare,url,nil];
CustomActivity *ca = [[CustomActivity alloc]init];
UIActivityViewController *activityVC =
[[UIActivityViewController alloc] initWithActivityItems:items
applicationActivities:[NSArray arrayWithObject:ca]];
activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard, UIActivityTypeSaveToCameraRoll];
activityVC.completionHandler = ^(NSString *activityType, BOOL completed)
{
NSLog(@" activityType: %@", activityType);
NSLog(@" completed: %i", completed);
};
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:activityVC];
CGRect rect = [[UIScreen mainScreen] bounds];
[self.popoverController
presentPopoverFromRect:rect inView:self.view
permittedArrowDirections:0
animated:YES];
}
else
{
[self presentViewController:activityVC animated:YES completion:nil];
}
}
Last edited: