In the following example, should you release versionCombined because that is the string that is initially allocated, or versionLabel since that's what the string is ultimately assigned to?
In the following example, should you release versionCombined because that is the string that is initially allocated, or versionLabel since that's what the string is ultimately assigned to?
In this code, you are responsible only for "versionCombined", because you are alloc/init-ing it.
That's what I originally thought, but if I try to release versionCombined, I get an "error: 'versionCombined' undeclared (first use in this function)". Whereas if I release versionLabel, it seems fine.
That's what I originally thought, but if I try to release versionCombined, I get an "error: 'versionCombined' undeclared (first use in this function)". Whereas if I release versionLabel, it seems fine.
If you're getting that error, it's during compilation, so you probably have a typo/misspelling between the variable you're declaring and the one you're releasing.
If you're getting that error, it's during compilation, so you probably have a typo/misspelling between the variable you're declaring and the one you're releasing.
Hmmm. I am literally doing a copy of the text "versionCombined" from my versionLabel method to the - (void)dealloc method. So if I understand your suggestion, I'm not sure how I've gotten a typo.
Hmmm. I am literally doing a copy of the text "versionCombined" from my versionLabel method to the - (void)dealloc method. So if I understand your suggestion, I'm not sure how I've gotten a typo.
OK, I see. The "versionCombined" variable is a local variable in the "versionLabel" method only. It's not a member variable, so it won't be available in your dealloc method. You should just release versionCombined once you've assigned its value to versionLabel.text in the versionLabel method.
OK, I see. The "versionCombined" variable is a local variable in the "versionLabel" method only. It's not a member variable, so it won't be available in your dealloc method. You should just release versionCombined once you've assigned its value to versionLabel.text in the versionLabel method.
Ah. OK. Think I'm with you now. So I should really release versionCombined from within my versionLabel method, and then release versionLabel in my dealloc method.