Should I retain a variable returned from this accessor?
Should I retain a variable returned from this accessor?
- Subject: Should I retain a variable returned from this accessor?
- From: Sean DeNigris <email@hidden>
- Date: Mon, 11 Aug 2008 15:12:05 -0400
Hi, how do I handle memory management for todoUid below? Do I have to
retain or autorelease it?
I'm using Scripting Bridge to communicate with iCal. Also, this is a
sub-routine and todoUid will only be used in the method that calls it.
- (NSString*) saveToiCalTodo: (NSString*) theSummary : (id)
theDescription
{
// Create new iCal todo
iCalTodo* newTodo = [[[iCal classForScriptingClass:@"todo"] alloc]
init];
// Add the todo to my iCal calendar
[[myCalendar todos] addObject:newTodo];
// Set its summary
[newTodo setSummary:theSummary];
// Store description
[newTodo setObjectDescription: theDescription];
// Get uid to return
NSString* todoUid = [newTodo uid];
// Clean up
[newTodo release];
newTodo = nil;
return todoUid;
}
Thanks in advance!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden