Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions EGOCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,27 @@ - (void)setString:(NSString*)aString forKey:(NSString*)key withTimeoutInterval:(
#if TARGET_OS_IPHONE

- (UIImage*)imageForKey:(NSString*)key {
UIImage* image = nil;

@try {
image = [NSKeyedUnarchiver unarchiveObjectWithFile:cachePathForKey(_directory, key)];
} @catch (NSException* e) {
// Surpress any unarchiving exceptions and continue with nil
}

return image;
UIImage* image = nil;
NSString *pathImage = nil;
@try {
pathImage = cachePathForKey(_directory, key);
image = [NSKeyedUnarchiver unarchiveObjectWithFile:pathImage];
if (!image) {
image = [UIImage imageNamed:pathImage];
}
} @catch (NSException* e) {

if (!image && pathImage){
@try {
NSData *data = [NSData dataWithContentsOfFile:pathImage];
image = [UIImage imageWithData:data];
} @catch (NSException *e1) {

}
}
}

return image;
}

- (void)setImage:(UIImage*)anImage forKey:(NSString*)key {
Expand Down