Fix crash during Archiving project in IOS

Summary:
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

  To fix issue that crash on XCode 9.3

Archive the project in XCode 9.3

This does not change any documentation

 To fix issue that crash on XCode 9.3

 [IOS] [BREAKING] [RCTImageCache.m] - Crash during archiving in XCode 9.3
Closes https://github.com/facebook/react-native/pull/18682

Differential Revision: D7992071

Pulled By: hramos

fbshipit-source-id: 1089e469712b1eb2fcdd3ad59766c187e932f46c
This commit is contained in:
fattahmuhyiddeen 2018-05-14 11:40:50 -07:00 committed by Facebook Github Bot
parent 07df36557c
commit 344c205070
1 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@
#import <React/RCTConvert.h>
#import <React/RCTNetworking.h>
#import <React/RCTUtils.h>
#import <React/RCTResizeMode.h>
#import "RCTImageUtils.h"
@ -22,8 +23,8 @@ static const NSUInteger RCTMaxCachableDecodedImageSizeInBytes = 1048576; // 1MB
static NSString *RCTCacheKeyForImage(NSString *imageTag, CGSize size, CGFloat scale,
RCTResizeMode resizeMode, NSString *responseDate)
{
return [NSString stringWithFormat:@"%@|%g|%g|%g|%lld|%@",
imageTag, size.width, size.height, scale, (long long)resizeMode, responseDate];
return [NSString stringWithFormat:@"%@|%g|%g|%g|%lld|%@",
imageTag, size.width, size.height, scale, (long long)resizeMode, responseDate];
}
@implementation RCTImageCache
@ -36,7 +37,7 @@ static NSString *RCTCacheKeyForImage(NSString *imageTag, CGSize size, CGFloat sc
{
_decodedImageCache = [NSCache new];
_decodedImageCache.totalCostLimit = 5 * 1024 * 1024; // 5MB
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(clearCache)
name:UIApplicationDidReceiveMemoryWarningNotification
@ -45,7 +46,7 @@ static NSString *RCTCacheKeyForImage(NSString *imageTag, CGSize size, CGFloat sc
selector:@selector(clearCache)
name:UIApplicationWillResignActiveNotification
object:nil];
return self;
}