Skip to content

Instantly share code, notes, and snippets.

@mcmurrym
Created December 18, 2017 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcmurrym/1fd1bb8b63147ac0101b37ecd4322e83 to your computer and use it in GitHub Desktop.
Save mcmurrym/1fd1bb8b63147ac0101b37ecd4322e83 to your computer and use it in GitHub Desktop.
NSExpression works great on the simulator and does not work on the device when using %@ and/or stringByAppendingFormat:
- (void)evaluate {
NSExpression *expression = [NSExpression expressionWithFormat:@"FUNCTION(source.firstName, 'stringByAppendingFormat:', ' %@', source.lastName)"];
NSDictionary *expressionObject = @{NSMigrationSourceObjectKey: @{@"firstName": @"tacos", @"lastName": @"burger"}};
id result = [expression expressionValueWithObject:expressionObject context:nil];
NSLog(@"%@", result);
}
//on simulator: "tacos burgers"
//on device: "tacos %@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment