我已經隔離了setExcludedActivityTypes數組的內存泄漏。請參閱下面的代碼:UIActivityController中的內存泄漏
- (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];
}
如果我運行的代碼與excludedItems數組聲明或暗示我仍然得到內存泄漏。如果我不包括任何排除項目的方式,我不會收到內存泄漏。所以我想我已經將它隔離到這個數組中。
有什麼我做錯了嗎?這可能是蘋果代碼中的錯誤嗎?
'excludedActivityTypes' /'setExcludedActivityTypes'如何聲明和實現? – Kevin
就像你在代碼中看到的一樣 - 沒有在NSArray * excludedItems之外的任何地方聲明... – RichNasser
你在使用ARC嗎? – JonahGabriel