Assume that:

NSMutableDictionary *result = [[NSMutableDictionary alloc] initWithCapacity:10];
        NSInteger ID;
And I add objects to the dictionary:

                [result setObject:[NSArray arrayWithObjects: {... objects ...}
                                                   nil]

                                   forKey:ID];

I am getting warnings when adding integers in the array and assigning
the integer ID as a key.
The Cocoa collection classes (eg: NSDictionary, NSArray, etc) always  
require object values, so you'll have to wrap your integer in an  
NSNumber like so:
        NSNumber* key = [NSNumber numberWithInteger:ID];
        [result setObject:whatever forKey:key];

Or, if you don't otherwise need to use the key, you can shorten that to:

        [result setObject:whatever forKey:[NSNumber numberWithInteger:ID]];

~Martin

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to