Created
December 18, 2017 23:09
-
-
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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