I have two arrays, I want to print values by names and alias. They are NSString values.
I`m a beginner in obj-c. I will be glad to any help.
And I’ll add everything you need to understand the cause of the problem, thanks!
NSArray <VBHuman*> * arrayOfHumans = [NSArray arrayWithObjects:
human, cycler, runner, swimmer, boxer,
nil];
NSArray <VBAnimal*> * arrayOfAnimals = [NSArray arrayWithObjects:
animal, dog, cat, hamster,
nil];
NSArray* newArray = @[];
newArray = [newArray arrayByAddingObjectsFromArray:arrayOfHumans];
newArray = [newArray arrayByAddingObjectsFromArray:arrayOfAnimals];
[newArray sortedArrayUsingDescriptors:
@[
[NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES],
[NSSortDescriptor sortDescriptorWithKey:@"alias" ascending:YES]
]];
In results it doesn't work, it has type following:
[<VBAnimal 0x6000002520f0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key name.