• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Should I retain a variable returned from this accessor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Should I retain a variable returned from this accessor?
      • From: Nathan Kinsinger <email@hidden>
    • Re: Should I retain a variable returned from this accessor?
      • From: "Kyle Sluder" <email@hidden>
  • Prev by Date: Re: Thread deadlock?
  • Next by Date: Objective-C and Cocoa Training in the MD/DC/VA Area?
  • Previous by thread: Change in NSDocument between 10.4 and 10.5
  • Next by thread: Re: Should I retain a variable returned from this accessor?
  • Index(es):
    • Date
    • Thread