I am attempting to get a thumbnail url using _valueForKeyPath_
but my json has a dictionary with the path and extension separated. I don't know how to have both path and extension together within valueForKeyPath
. Any help?
I tried taking a look at this, but I believe it doesn't solve my issue. Here is how my code looks like thus far:
+ (instancetype) characterWithDictionary: (NSDictionary *) dictionary {
MCUCharacter *character = [[MCUCharacter alloc] init];
if ( character ) {
character.characterImageURL = [NSURL URLWithString:[dictionary valueForKeyPath:@"thumbnail.path.extension"]];
NSLog(@"Character Image URL: %@", character.characterImageURL);
}
return character;
}
And here is the json :
"thumbnail": {
"path": "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784",
"extension": "jpg"
}, code here