From a2000d120069f9a9ee60e4a92ab8fc209333e584 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Wed, 15 Feb 2017 03:41:32 -0800 Subject: [PATCH] Replace valueForKey with subscript access in RCTJavascriptLoader Reviewed By: shergin Differential Revision: D4559391 fbshipit-source-id: 44cb4900f93f2ac60dae3a461ed5344e1af08f3b --- React/Base/RCTJavaScriptLoader.mm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index eacdf024f..60fa2c682 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -230,7 +230,7 @@ static void attemptAsynchronousLoadOfBundleAtURL(NSURL *scriptURL, RCTSourceLoad // For multipart responses packager sets X-Http-Status header in case HTTP status code // is different from 200 OK - NSString *statusCodeHeader = [headers valueForKey:@"X-Http-Status"]; + NSString *statusCodeHeader = headers[@"X-Http-Status"]; if (statusCodeHeader) { statusCode = [statusCodeHeader integerValue]; } @@ -263,9 +263,9 @@ static RCTLoadingProgress *progressEventFromData(NSData *rawData) } RCTLoadingProgress *progress = [RCTLoadingProgress new]; - progress.status = [info valueForKey:@"status"]; - progress.done = [info valueForKey:@"done"]; - progress.total = [info valueForKey:@"total"]; + progress.status = info[@"status"]; + progress.done = info[@"done"]; + progress.total = info[@"total"]; return progress; } @@ -281,12 +281,11 @@ static NSDictionary *userInfoForRawResponse(NSString *rawText) } NSMutableArray *fakeStack = [NSMutableArray new]; for (NSDictionary *err in errors) { - [fakeStack addObject: - @{ + [fakeStack addObject: @{ @"methodName": err[@"description"] ?: @"", @"file": err[@"filename"] ?: @"", @"lineNumber": err[@"lineNumber"] ?: @0 - }]; + }]; } return @{NSLocalizedDescriptionKey: parsedResponse[@"message"] ?: @"No message provided", @"stack": [fakeStack copy]}; }