• 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
Re: Do I need to relase @"string" ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Do I need to relase @"string" ??


  • Subject: Re: Do I need to relase @"string" ??
  • From: Dave DeLong <email@hidden>
  • Date: Mon, 02 Mar 2009 14:03:17 -0700

For good practice, yes. In this isolated example, I don't believe so (because I'm pretty sure NSConstantString overrides -retainCount so that it can't ever be released).

You may also want to consider simplifying your code to:
...
NSString * miles[8] = {@"200", @"500", @"1000", @"1500", @"2000", @"2500", @"5000", @"10000"};
[appDelegate setCurrentMiles:miles[indexPath.row]];
...


HTH,

Dave

On Mar 2, 2009, at 1:58 PM, James Cicenia wrote:

hello

Here is my code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
WhatsFreshAppDelegate *appDelegate = (WhatsFreshAppDelegate *) [[UIApplication sharedApplication] delegate];


if(indexPath.row == 0){
[appDelegate setCurrentMiles:@"200"];
}else if(indexPath.row==1){
[appDelegate setCurrentMiles:@"500"];
}else if(indexPath.row==2){
[appDelegate setCurrentMiles:@"1000"];
}else if(indexPath.row==3){
[appDelegate setCurrentMiles:@"1500"];
}else if(indexPath.row==4){
[appDelegate setCurrentMiles:@"2000"];
}else if(indexPath.row==5){
[appDelegate setCurrentMiles:@"2500"];
}else if(indexPath.row==6){
[appDelegate setCurrentMiles:@"5000"];
}else if(indexPath.row==7){
[appDelegate setCurrentMiles:@"10000"];
}
[appDelegate setupStateDisplay:[appDelegate currentLatitude] longString:[appDelegate currentLongitude] milesString:[appDelegate currentMiles]];
[appDelegate refreshLocation:TRUE];
[(MyLocationViewController *)myParentController resetMiles];


}


DO I HAVE TO WORRY ABOUT RELEASING currentMiles somewhere?
_______________________________________________

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


References: 
 >Do I need to relase @"string" ?? (From: James Cicenia <email@hidden>)

  • Prev by Date: Do I need to relase @"string" ??
  • Next by Date: Re: Custom file types and extensions
  • Previous by thread: Do I need to relase @"string" ??
  • Next by thread: Re: Do I need to relase @"string" ??
  • Index(es):
    • Date
    • Thread