Skip to content

Commit

Permalink
Added OS X support
Browse files Browse the repository at this point in the history
  • Loading branch information
belkevich committed Jan 30, 2014
1 parent 528eea4 commit 48037b8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Classes/Public/APSmartStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ - (id)init
if (self)
{
_taskManager = [[APTaskManager alloc] init];
#if TARGET_OS_IPHONE
NSNotificationCenter *center = NSNotificationCenter.defaultCenter;
[center addObserver:self selector:@selector(didReceiveMemoryWarning:)
name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
#endif
}
return self;
}

- (void)dealloc
{
#if TARGET_OS_IPHONE
[NSNotificationCenter.defaultCenter removeObserver:self];
#endif
}

#pragma mark - singleton
Expand Down Expand Up @@ -212,12 +216,14 @@ - (void)objectFromNetworkWithURL:(NSURL *)url callback:(void (^)(id object, NSEr
}];
}

#if TARGET_OS_IPHONE
- (void)didReceiveMemoryWarning:(NSNotification *)notification
{
[self.memoryStorage removeAllObjects];
_memoryStorage = nil;
_fileStorage = nil;
_networkStorage = nil;
}
#endif

@end

0 comments on commit 48037b8

Please sign in to comment.