I am while using data with core data and obtain an NSSet of NSNumber... my real question is how do i do in order to change easily all of the objects into int values? or can one directly obtain the int values in the database?


NSSet cannot store primitive values for example int, this is exactly why NSNumber can be used. Frequently you can easily use NSNumber without having done any casting. Should you choose require the int value call [mynumber intValue].

Keep your NSSet because it is.

You will get the int values of the NSNumber easily.

int intValue = [myNSNumber intValue];

This doesn't answer your question, but it is related and it is insanely helpful.

Let us say I've got a collection (NSArray, NSSet, etc) of objects of the certain type, which objects possess a method/property known as displayValue that in some way transforms the item right into a more user-friendly format for exhibiting. To change my assortment of objects into an accumulation of their displayValues, I only have to do:

NSArray * objects = ...;
NSArray * objectDisplayValues = [objects valueForKey:@"displayValue"];

The only real caveat is when displayValue returns a primitive (int, float, a struct, etc), it will likely be boxed in to the appropriate NSValue container.

So theoretically you could do this:

NSArray * numbers = ...;
NSArray * intValues = [numbers valueForKey:@"intValue"];

Consider the intValue could be boxed into an NSNumber, you would be back in which you began.

When I stated, this is not exactly a solution, but it is dead helpful.