Normally I do something like this (below) to get value I need:
NSDictionary *state = [notification.userInfo objectForKey:@"state"];
[self.tabBarItem setBadgeValue:[state objectForKey:@"short"]];
But does it worth to do retain/release for values taken from NSDictionary? Something like this:
NSDictionary *state = [[notification.userInfo objectForKey:@"state"] retain];
[self.tabBarItem setBadgeValue:[state objectForKey:@"short"]];
[state release];
Is it more memory friendly? Or I shouldn’t bother and just trust to autorelease pool to do its job?
No, there’s no point in doing that. The result of
[notification.userInfo objectForKey:@"state"]is always an autoreleased object; if you add an extraretainandrelease, that won’t change anything.