Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>updateResult</code> is an instance variable which prevents the object from being deallocated as it is retained by that block. </p> <p>In other words, you got a retain cycle. The object retains the block and the block retains the object.</p> <p>You will need to create a weak or unsafe_unretained reference to that instance and its variable for loosing that relationship.</p> <p>Add the following prior to your notification block:</p> <pre><code>__unsafe_unretained YouObjectClass *weakSelf = self; </code></pre> <p>or (in case you are on iOS5 and above)</p> <pre><code>__weak YouObjectClass *weakSelf = self; </code></pre> <p>Then, within that block, reference the object via that new weak reference:</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserverForName:@"Update result"                                                   object:nil                                                    queue:nil                                               usingBlock:^(NSNotification *note) {                                                   weakSelf.updateResult = YES;                                               }]; </code></pre> <p>Please note that retain-cycles are not a bad thing per se. Sometimes you actually want them to happen. But those are instances where you are certain that the cycle will be broken after a specific time (e.g. Animation Blocks). The cycle is broken once the block has executed and is removed from the stack.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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