Note that there are some explanatory texts on larger screens.

plurals
  1. PONSNotification not sent/received
    primarykey
    data
    text
    <p>I've been trying to figure this out for a whole day now and I'm starting to become desperate... So here is my problem:</p> <p>I have a table view controller showing a list of files. The user can download new files to this list. I handle the downloads asynchronously in a separate class. When a new file has been downloaded I want to notify the table view controller, so it can update the list. The delegate pattern doesn't really fit here, because multiple instances have to be notified, so I want to use NSNotificationCenter.</p> <p>In the view controller's viewDidAppear: method I register as an observer:</p> <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadComplete:) name:kDownloadCompleteNotification object:nil]; </code></pre> <p>This is called definitely before posting the notification, because the user has to tap the add button on the view controller to start a new download. When the download is done I post the notification (in the DownloadManager class):</p> <pre><code>[[NSNotificationCenter defaultCenter] postNotificationName:kDownloadCompleteNotification object:self]; </code></pre> <p>However, my notification handler method in the view controller is never called. I added breakpoints and it's just not called. I also tried to set the object to nil. No difference.</p> <pre><code>- (void)downloadComplete:(NSNotification *)notification { NSLog(@"Inserting new files into table view."); } </code></pre> <p>Both, registering and posting the notification is done on the main thread (I don't think that matters anyway). The view controller is not released or anything. I didn't make any typo as far as I can tell. The name strings are the same constant. </p> <p>If set the name argument to nil when registering as an observer, I receive all kind of (system) notifications, but not my own ones. However if I post a test notification right after registering (in viewDidAppear) it works.</p> <p>I don't know what else I should check... Any hint is very appreciated. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    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. 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