You could compare the count of the NSSet before and after attempting the add.
NSInteger setCount = [mySet count];
[mySet addObject:foo];
if ([mySet count] > setCount) {
// object was added
}
You could also perform a containsObject test before adding the object:
if ([mySet containsObject:foo]) {
// object already exists
} else {
// object is not yet in the set
[mySet addObject:foo];
[myArray addObject:foo];
}
Yet another option is to simply add objects to a set, then convert the set to an array when you are done:
[mySet addObject:foo];
NSArray *myArray = [mySet allObjects];