> 
> **Possible Duplicate:**  
> 
> [Understanding when to call retain on an object?](https://stackoverflow.com/questions/4450644/understanding-when-to-call-retain-on-an-object) 
> 
> 
> 

I have a hard time to understand when I have to retain an object? Is there a general rule?

For example:

```
- (IBAction)buttonPressed:(UIButton *)button{

    // some code

    NSString *buttonText = button.titleLabel.text;
    //retain needed or not ?
    [buttonText retain];
    double result = [someObject someMethod:buttonText];

    // some more code
}

```