title: Not receiving NSNotification
body: <p>I'm having trouble receiving an <code>NSNotification</code>. I can tell that my network call is effective on the server side, and that the server's response is received at the network layer in my app, but when my network layer class does the final step of sending an <code>NSNotification</code> to the <code>UIViewController</code>, that notification is never received. As a result, my app hangs, even though everything else worked as intended.</p>
  
  <p>Here is the UIViewController that initiates everything:</p>
  
  <pre><code>- (void) updateAffiliations
  {
      [self.activityIndicator startAnimating];
      self.activityIndicator.hidden = NO;
  
      Updater *updater = [[Updater alloc] init];
      NSDictionary *clearTextParams = [updater makeDictionary];
      NSString *phpPath = @"updateRecord.php";
      NSDictionary *parameters = [[SharedCipher sharedCipher] encryptParameters:clearTextParams];
  
      _preferenceUpdateResponse = @"preferencesResponse";
  
      [[NSNotificationCenter defaultCenter] addObserver : self
                                               selector : @selector(preferenceUpdateResult:)
                                                   name : _preferenceUpdateResponse
                                                 object : nil];
  
      [[SharedNetworkObject sharedNetworkObject] sendHttpPost : phpPath
                                                   parameters : parameters
                                             notificationName : _preferenceUpdateResponse];
      NSLog(@"sent");
  }
  
  - (void) preferenceUpdateResult: (NSNotification *) notification
  {
      NSLog(@"response received from network layer");
      NSDictionary *dict = [notification userInfo];
  
      [self.activityIndicator stopAnimating];
      self.activityIndicator.hidden = YES;
  
      //...
  }
  </code></pre>
  
  <p>The network layer that I refer to is a singleton class called SharedNetworkObject. I've used this class repeatedly, and this is the only instance where this problem is happening:</p>
  
  <pre><code>- (void) sendHttpPost : (NSString *) phpPath
             parameters : (NSDictionary *) parameters
       notificationName : (NSString *) notificationName
  {
      NSLog(@"sending http post to : %@", phpPath);
      NSLog(@"params: %@", parameters);
  
      [self POST : phpPath
      parameters : parameters
         success : ^(NSURLSessionDataTask *task, id responseObject)
               {
                   NSLog(@"response object: %@", responseObject);
                   NSLog(@"broadcasting notification to : %@", notificationName);
                   [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil userInfo:responseObject];
               }
  
         failure : ^(NSURLSessionDataTask *task, NSError *error)
               {
                   NSLog(@"Shared Network Object error: %@", error);
                   NSDictionary * userInfo = @{ @"result" : @"failure", @"error" : error };
                   [[NSNotificationCenter defaultCenter] postNotificationName : notificationName object:nil userInfo:userInfo];
               }];
  }
  </code></pre>
  
  <p>Here is an example of the console output to show the progress (and then the lack of progress). No errors occur, but the app hangs since the last notification is not received:</p>
  
  <blockquote>
    <p>sending http post to : updateRecord.php <br>
    params: {<br>
        ciphertext = "ignore this, lots of encrypted jibberish";<br>
        "device_iv" = "0Q7yxsTpzQEaDGPpJ96JrA==";<br>
        paddLength = 11;<br>
        "session_id" = 845903271; <br>}<br> 
    sent <br>
    response object: {<br>
        message = "successfully updated record";<br>
        result = success; <br>} 
    <br>broadcasting notification to : preferencesResponse<br></p>
  </blockquote>
  
  <p>This output looks fine, except that it is incomplete. There should be one last line that says </p>
  
  <blockquote>
    <p>response received from network layer</p>
  </blockquote>
  
  <p>But this never outputs because the notification is never received. I've checked for all of the usual reasons that result in notifications never returning, and I think that this is right. In fact, I use this exact pattern three other times in other places, and they all work perfectly. </p>
  
  <p>Anyone see what I am doing wrong here? Is this maybe a threading issue?</p>
  
  <p>Thanks very much!</p>