More efficient dynamic->NSString conversion.

Reviewed By: yfeldblum

Differential Revision: D5492783

fbshipit-source-id: 40cb24a67e7cc15b01266481e3002ea3a00b17bd
This commit is contained in:
Andrew Krieger 2017-07-26 18:23:20 -07:00 committed by Facebook Github Bot
parent 113e046444
commit 886ef0c1ba
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ id convertFollyDynamicToId(const folly::dynamic &dyn) {
case folly::dynamic::DOUBLE:
return @(dyn.getDouble());
case folly::dynamic::STRING:
return [[NSString alloc] initWithData:[NSData dataWithBytes:dyn.data() length:dyn.size()]
return [[NSString alloc] initWithBytes:dyn.c_str() length:dyn.size()
encoding:NSUTF8StringEncoding];
case folly::dynamic::ARRAY: {
NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:dyn.size()];