title: objc_getAssociatedObject returns null
body: <p>Here's how I set the associated object:</p>
  
  <pre><code>objc_setAssociatedObject(navigationItem, "rightButton", leftButtonView, OBJC_ASSOCIATION_RETAIN);
  </code></pre>
  
  <p>and here's how I get it:</p>
  
  <pre><code>UIButton *favoriteButton = (UIButton *)objc_getAssociatedObject(self.navigationItem, "rightButton");
  </code></pre>
  
  <p>The object is a <code>UIButton</code> in both instances, and I have the <code>#import "objc/runtime.h"</code> in both classes.</p>
  
  <p>The thing is, it used to work, but now for some reason it returns <code>null</code>. Any ideas?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I'm setting the associated object in another class by passing the <code>navigationItem</code> as an argument:</p>
  
  <pre><code>+ (void)setNavigationBarTitle:(NSString *)title 
                  andLeftButton:(NSString *)leftButtonTitle 
                   withSelector:(SEL)leftSelector 
                 andRightButton:(NSString *)rightButtonTitle 
                   withSelector:(SEL)rightSelector 
                      andTarget:(id)target 
              forNavigationItem:(UINavigationItem *)navigationItem;
  </code></pre>
  
  <p>I use this convenience method in my utility class to set up a navigation bar for each new view controller in my app. When creating the navigation bar buttons, I associate them with the navigation item - my first line of code in the question.</p>