If you have a custom object, you may need to override description
Without overriding:
-(void) testCustomObjects
{
CustomObject *co1 = [[CustomObject alloc] init];
co1.name = @"James Webster";
co1.jobTitle = @"Code Monkey";
CustomObject *co2 = [[CustomObject alloc] init];
co2.name = @"Holly T Canine";
co2.jobTitle = @"Pet Dog";
NSSet *set = [NSSet setWithObjects:co1, co2, nil];
NSLog(@"%@", [set allObjects]);
}
produces:
2016-12-02 11:45:55.342 Playground[95359:4188387] (
"<CustomObject: 0x600000037a20>",
"<CustomObject: 0x60000003ae20>"
)
However, if I override the description
method in my CustomObject
class:
-(NSString*) description
{
return [NSString stringWithFormat:@"%@ (%@)", self.name, self.jobTitle];
}
I get the following:
(
"Holly T Canine (Pet Dog)",
"James Webster (Code Monkey)"
)
If for whatever reason, you can't add a description method, you'd just have to access the relevant parts of the object; something like the following:
NSArray *ar = [customer.addresses allObjects];
for (int i = 0; i<ar.count; i++)
{
NSLog(@"arr %@ (%@)",ar[i].name, ar[i].address);
}
I've had a little look at the library you're using. Try the following:
for (BUYAddress *address in customer.addresses)
{
NSLog(@"Address: %@, %@, %@", address.address1, address.address2, address.city);
}
-description
in theBUYAddress
class to provide customised information about the instance during logging. – Kavanaugh