Может кто-нибудь, пожалуйста, помогите мне обнаружить утечку. Я действительно не знаю, где моя утечка. Так что я опубликую свой код здесь, и, надеюсь, кто-то может найти его для меня. В инструменте утечки написано, что ответственный кадр - dispatch_semaphore_create
, который я не называю?
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if ([defaults boolForKey:@"notFirstRunSeminars"]) {
BOOL isUpdated = self.seminarsParser.seminarsAreUpdated;
if (isUpdated) {
DLog(@"Seminars have been updated");
[[NSNotificationCenter defaultCenter]
postNotificationName:@"updateSeminarsTable"
object:nil];
[[[[[self tabBarController] tabBar] items] objectAtIndex:kSeminarsTabIndex] setBadgeValue:self.seminarsParser.numberOfNewSeminars];
self.seminarsParser.numberOfNewSeminars = nil;
}
}
});
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if ([defaults boolForKey:@"notFirstRunCareers"]) {
BOOL isUpdated = self.careersParser.careersAreUpdated;
if (isUpdated) {
DLog(@"Careers have been updated");
[[NSNotificationCenter defaultCenter]
postNotificationName:@"updateCareersTable"
object:nil];
[[[[[self tabBarController] tabBar] items] objectAtIndex:kCareersTabIndex] setBadgeValue:self.careersParser.numberOfNewCareers];
self.careersParser.numberOfNewCareers = nil;
}
}
});
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if ([defaults boolForKey:@"notFirstRunOffices"]) {
BOOL isUpdated = [officesParser officesAreUpdated];
if (isUpdated) {
DLog(@"Offices have been updated");
[[NSNotificationCenter defaultCenter]
postNotificationName:@"updateOfficesTable"
object:nil];
}
}
});
dispatch_group_notify(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
});
});