ios - How to fix memory leak for UIActivityViewController presented in a UIPopoverController -
similar this post , this one i'm creating uiactivityviewcontroller sharing option in app (arc activated). it's universal app, i'm presenting uiactivityviewcontroller modally iphone/ipod , inside popover ipad. while profiling app instruments detected memory leaks nsarray inside function creating uiactivityviewcontroller:
myactivityitemprovider *activityitemprovider = [[myactivityitemprovider alloc] init];//custom activity item provider nsarray *items= [nsarray arraywithobjects:activityitemprovider, nil]; uiactivityviewcontroller *activity = [[uiactivityviewcontroller alloc] initwithactivityitems:items applicationactivities:nil]; [activity setexcludedactivitytypes:[nsarray arraywithobjects:uiactivitytypeassigntocontact,uiactivitytypeprint,uiactivitytypesavetocameraroll,uiactivitytypeposttoweibo, uiactivitytypemessage,nil]];
using answer (__block , completion destroy array excluded activity items) posts mentioned above, managed fix leak iphone since function presentviewcontroller provide completion handler.
how can set uiactivitycontroller , it's excludedactivitytypes nil in case of presenting in popover? found uiactivityviewcontroller provides completionhandler property, can't wrap head around how use without creating cycle...
thanks in advance!
as on requirement try code
__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;}];
Comments
Post a Comment