I am new to coding and trying to get up to speed with Objective-C. Came across some code I did not understand. I was hoping someone could clarify it for me. In the case belo
From your simple example it is really hard to say what is going on. Typically [class add:] type methods return void, so they should raise a compiler warning that 'void value is not ignored as it should be.'
So without more info, it is a bit hard to figure things out.
A few things to keep in mind:
you can send commands to 'nil' in objc. So, if [foo add:pointer] returns nil, then you can call 'release' on it all day with no affect.
retainCount is your friend. You can call it on any NSObject to see how many objects are holding onto it. This may also help you track down the issue.
Finally, is Garbage Collection on?