title: Using objective-c objects with an NSDictionary
body: <p>I want store a URL against a UILabel so that when a user touches the label it takes them to that URL in a UIWebView.</p>
  
  <p>I have declared a NSDictionary like so:</p>
  
  <pre><code>NSMutableArray *linksArray = [[NSMutableArray alloc] init];
  [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem1ReadMoreLabel]];
  [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem2ReadMoreLabel]];
  [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem3ReadMoreLabel]];
  [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem4ReadMoreLabel]];
  [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem5ReadMoreLabel]];
  //NSString *ageLink = @"http://www.theage.com.au";
  NSArray *defaultLinks = [NSArray arrayWithObjects: @"1", @"2", @"3", @"4", @"5", nil];
  self.urlToLinkDictionary = [[NSMutableDictionary alloc] init];
  self.urlToLinkDictionary = [NSDictionary dictionaryWithObjects:defaultLinks forKeys:linksArray];
  </code></pre>
  
  <p>Considering I used a <code>NSValue</code> as the key, how do I get/set the URL associated with that key given that I only have references to the UILabels?</p>
  
  <p>this is what I have but it doesn't work:</p>
  
  <pre><code>for(NSValue *key in [self.urlToLinkDictionary allKeys])
  {
      if ([key nonretainedObjectValue] == linkedLabel)
      {
          [self.urlToLinkDictionary setValue:[newsItem link] forKey: key];
      }
  }
  </code></pre>
  
  <p>but I get an error: "objc_exception_throw" resolved</p>