Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDictionary and retaining values



Hi,


Does NSDictionary retain the objects (values) that are added?

Shouldn't "n" be 2 below?


Thanks.


int main(int argc, char *argv[])

{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    

NSMutableArray *kArr = [NSMutableArray arrayWithObjects:@"1", @"2", @"3", @"4", nil];

NSMutableArray *aArr = [NSMutableArray arrayWithObjects:@"2", nil];

NSDictionary *aDic = [NSDictionary dictionaryWithObjectsAndKeys:

@"K", kArr, @"A", aArr, nil];

int n = [kArr retainCount];

// Shouldn't n be 2 here?

        [pool release];

         return 0;

}


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.