| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
NSEnumerator *allDistantObjects= [ ... ];
id theDistantObject;
[theDictionary autorelease];
while(theDistantObject= [allDistantObjects nextObject])
{
[theDistantObject updateWithDictionary: theDictionary];
}
In other word, is it safe to autorelease the dictionary before I send it out, it should be right since its a copy anyways. Would it also be safe to instead of autorelease it, release it after all the messages are sent? I would assume so but I wanted to make sure.
[myObject beginEditing];
[myObject setObject: someObject forKey: @"hello"];
[myObject setObject: someObject2 forKey: @"bye"];
[myObject endEditing];
[distantObject updateWithDictionary: [myObject editedProperties]];
My idea is that internall, myObject would have a editedProperties dictionary, and would set someObject to @"hello", etc. Then, when you call endEditing, I plan on sending that dictionary the autorelease message:
- (void)beginEditing
{
editedProperties= [[NSMutableDictionary alloc] init];
}
- (void)endEditing
{
[editedProperties autorelease];
}
Is this "safe"? Or is there a chance of the editedProperties being deallocated before I send it out.
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.