iphone - UIActivityViewController - can't understand this memory leak -
can please tell me why next code leaking in 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];
instruments show leak on row:
activitycontroller.excludedactivitytypes = [nsarray arraywithobjects:@"a",@"b", nil];
the next should trick (__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];
see so
iphone ios objective-c memory-leaks uiactivityviewcontroller
No comments:
Post a Comment