Note that there are some explanatory texts on larger screens.

plurals
  1. POperformSelector:withObject: and its retain behavior
    primarykey
    data
    text
    <p>This is an already answer question within SO but <strong>I cannot find it in the Apple documentation anywhere</strong>. Could you point me in the right direction?</p> <p>Within the following topics</p> <p><a href="https://stackoverflow.com/questions/1240308/do-i-have-to-retain-an-object-before-passing-it-to-performselectorwithobjecta">Do I have to retain an object before passing it to -performSelector:withObject:afterDelay:?</a></p> <p><a href="https://stackoverflow.com/questions/4414699/the-effect-on-retain-count-of-performselectorwithobjectafterdelayinmodes">the effect on retain count of performSelector:withObject:afterDelay:inModes</a></p> <p><a href="https://stackoverflow.com/questions/10928118/is-object-that-calls-performselectorwithobjectafterdelay-get-retained-by-the-n">Is object that calls performSelector:withObject:afterDelay get retained by the NSRunLoop?</a></p> <p>the default behaviour seems to be the following: <strong>it retains the receiver and the argument(s)</strong>.</p> <p>I'm using the following code</p> <pre><code>[[self delegate] performSelector:@selector(tryToSendStoreData:) withObject:userData]; </code></pre> <p>where <code>userData</code> is an autoreleased oject.</p> <p>Logging the retain count (<strong>I know that it could be not valid to do it</strong>) the data passed in increments its retain count. When the method is invoked on the delegate, the retain count is not equal to one.</p> <p>So, my question is: do I need to perform some memory management to avoid leaks or do I have to trust on Apple stuff? Here I'm speaking as an agnostic since I cannot find the right docs.</p> <p>Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload