I have isolated a memory leak to the setExcludedActivityTypes array. See code below:
- (void)postToFacebook:(UITapGestureRecognizer *)sender
{
NSString *postText = socialString;
UIImage *imageToPost = [self captureTheScreenImage];
NSArray *postItems = @[postText, imageToPost];
UIActivityViewController *activityPostVC = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil];
//NSArray *excludedItems = @[UIActivityTypePostToWeibo,UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll, UIActivityTypeMail, UIActivityTypeMessage];
//[activityPostVC setExcludedActivityTypes:excludedItems];
[activityPostVC setExcludedActivityTypes:@[UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll, UIActivityTypeMail, UIActivityTypeMessage]];
[self presentViewController:activityPostVC animated:YES completion:nil];
}
If I run the code either with the excludedItems array declared or implied I still get the memory leak. If I do not include either way of excluding items, I don't get a memory leak. So I think I've isolated it to this array.
Is there something I am doing wrong? Could this be a bug in Apple's code?