有人可以告诉我为什么以下代码在仪器中泄漏了吗?
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityController.excludedActivityTypes = [NSArray arrayWithObjects:@"a",@"b", nil];
[self presentViewController:activityController animated:YES completion:nil];
[activityController release];
仪器显示行上的泄漏:
activityController.excludedActivityTypes = [NSArray arrayWithObjects:@"a",@"b", nil];
答案 0 :(得分:0)
以下应该做的技巧(__block和完成)
__block UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
activityController.excludedActivityTypes = [NSArray arrayWithObjects:@"a",@"b", nil];
[self presentViewController:activityController animated:YES completion:^{ activityController.excludedActivityTypes=nil; activityController=nil;}];
[activityController release];
另见SO