objective c - Releasing of strings -


I suspect that the string should be issued. I have not given any allocated strings for the string?

No, if you are issuing the string automatically, then not. For example

  NSString * aTestString = [NSString stringWithFormat: @ "Hello% @", @ "World"];  

This string is an automatic release, so you do not need to call [aestestring release];

If you do:

  NSString * aTestString = [[NSString alloc] initWithFormat: @ "Hello% @", @ "World"];  

Then you must issue it [aestestring release]; Because you are allocated manually, so it is worth noting yourself, so you should have it later

  NSString * aTestString = [[[NSString alloc] initWithFormat: @ "Hello% @", @ Need not be considered @ world]] autorelease];  

But it will be just like the first part of the code I gave you. Back to the point, no, you Manually do not need to release it until you allocate yourself.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -