title: Objective-C Problems with NSDictionary and NSURL
body: <p>I am new to Objective-C and I have no clue why this code is not working:</p>
  
  <pre><code>    NSMutableDictionary *bookmarks = [NSMutableDictionary dictionaryWithCapacity:(NSUInteger) 4];
  [bookmarks setObject:@"Stanford University" forKey:[NSURL URLWithString:(NSString *) @"http://www.stanford.edu"]];
  [bookmarks setObject:@"Apple" forKey:[NSURL URLWithString:(NSString *) @"http://www.apple.com"]];
  [bookmarks setObject:@"Berkeley" forKey:[NSURL URLWithString:(NSString *) @"http://www.berkeley.edu"]];
  [bookmarks setObject:@"CS193P" forKey:[NSURL URLWithString:(NSString *) @"http://cs193p.stanford.edu"]];
  
  NSEnumerator *browser = [bookmarks keyEnumerator];
  id each;
  NSURL *url;
  while ((each = [browser nextObject])) {
      url = [browser valueForKey:(NSString *)each];
      NSLog(@"%@", [url absoluteURL]);
  }
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>2009-06-29 11:25:22.844 WhatATool[2102:10b] *** -[NSURL length]: unrecognized selector sent to instance 0x1072c0
  2009-06-29 11:25:22.845 WhatATool[2102:10b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL length]: unrecognized selector sent to instance 0x1072c0'
  </code></pre>
  
  <p>Any help would be appreciated.
  Thanks.</p>