0

次のコードがInstrumentsでリークしている理由を誰かに教えてもらえますか?

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];
4

1 に答える 1

0

以下はトリックを行う必要があります(__blockとcompletion)

__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も参照してください

于 2013-02-20T22:18:25.137 に答える