views:

16

answers:

1

I have a NSArray object retrieved from the standard user defaults object, [NSUSerDefaults standardUserDefaults]. I want to save this array as a member variable of another object and use it for the lifetime of this object.

I'm not sure if the array from NSUserDefaults is an autorelease object. Should I retain the array?

+1  A: 

You should retain the array.

You can see that since there is not a copy/new/alloc involved here that the returned object is not retained automatically. That means you need to retain.

The two possibilities are that the object is autoreleased or just retained inside NSUSerDefaults (most likely).

willcodejavaforfood
I think it's logical to retain it. Thanks!
Jeff