rs/SDWebImage — Issue #54: Useless check
Author: jfradj
Created: 2011-12-19 10:36:34+00:00
State: open

I think the device check is useless because due to the #if, the code will be executed on iOS4 device only, on this OS version the key UIApplicationDidEnterBackgroundNotification is defined, and the notification will be sent only on devices that are multitasking capable.

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_4_0
UIDevice *device = [UIDevice currentDevice];
if ([device respondsToSelector:@selector(isMultitaskingSupported)] && device.multitaskingSupported)
{
// When in background, clean memory in order to have less chance to be killed
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(clearMemory)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
}
#endif

Cheers