iOS Memory Leak with Activity View -
i discovered memory leak in app i'm not sure how go fixing it. involves activity view used share url of current article being viewed rss feed. i'm not sure why leak happening. ideas or advice?
the method in question iphone version is:
- (void) showmenu { nsurl *urltoshare = hackyurl; nsarray *activityitems = @[urltoshare]; tusafariactivity *activity = [[tusafariactivity alloc] init]; uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc]initwithactivityitems:activityitems applicationactivities:@[activity]]; activityvc.excludedactivitytypes = @[uiactivitytypeassigntocontact, uiactivitytypeposttoweibo, uiactivitytypesavetocameraroll]; [self presentviewcontroller:activityvc animated:true completion:nil]; }
edit: i've fixed iphone leak changing above code this:
__block uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc]initwithactivityitems:activityitems applicationactivities:@[activity]]; activityvc.excludedactivitytypes = @[uiactivitytypeassigntocontact, uiactivitytypeposttoweibo, uiactivitytypesavetocameraroll]; [self presentviewcontroller:activityvc animated:yes completion:^{activityvc.excludedactivitytypes = nil; activityvc = nil;}];
the ipad version same except uses popover display activity view.
- (void)showmenu { nsurl *urltoshare = hackyurl; nsarray *activityitems = @[urltoshare]; tusafariactivity *activity = [[tusafariactivity alloc] init]; uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc]initwithactivityitems:activityitems applicationactivities:@[activity]]; activityvc.excludedactivitytypes = @[uiactivitytypeassigntocontact, uiactivitytypeposttoweibo, uiactivitytypesavetocameraroll]; if ([popover ispopovervisible]) { [popover dismisspopoveranimated:yes]; popover = nil; } else { self.popover = [[uipopovercontroller alloc]initwithcontentviewcontroller:activityvc]; [self.popover presentpopoverfrombarbuttonitem:systemaction permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; } }
i've fixed iphone leak changing above code this:
__block uiactivityviewcontroller *activityvc = [[uiactivityviewcontroller alloc]initwithactivityitems:activityitems applicationactivities:@[activity]]; activityvc.excludedactivitytypes = @[uiactivitytypeassigntocontact, uiactivitytypeposttoweibo, uiactivitytypesavetocameraroll]; [self presentviewcontroller:activityvc animated:yes completion:^{activityvc.excludedactivitytypes = nil; activityvc = nil;}];
but can't figure out how fix leak popover on ipad.
Comments
Post a Comment