• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NSMutableDictionary setObject:forKey:] problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSMutableDictionary setObject:forKey:] problem


  • Subject: Re: [NSMutableDictionary setObject:forKey:] problem
  • From: Joachim <email@hidden>
  • Date: Wed, 19 Oct 2005 19:15:19 -0700

Thanks for your feedback, j o a r, Elias and m. It all makes sense - even I should have known. The code now works as shown below.

On 19-Oct-05, at 3:15 PM, m wrote:

"@selector(objectForKey)" should be "@selector (objectForKey:)" (note the colon; this is a common error beginners make)

Funny enough, I couldn't remember this call, but remembered Will Shipley had posted a snippet on his blog. And I took the code from there. Notice the missing colons in his calls - he's obviously a beginner ;-)


http://wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html

Best regards,
Joachim

- (void) parseXMLData
{
NSDictionary *iPhotoDict = [[NSDictionary alloc] initWithContentsOfFile:albumDataXMLFilePath];
NSArray *iPhotoAlbums = [iPhotoDict objectForKey:@"List of Albums"];
NSEnumerator *enumerator = [iPhotoAlbums objectEnumerator];
id iPhotoAlbumDict;


    if (albumDict)
        [albumDict removeAllObjects];
    else
        albumDict = [[NSMutableDictionary alloc] init];

    while (iPhotoAlbumDict = [enumerator nextObject]) {

if ([iPhotoAlbumDict respondsToSelector:@selector (objectForKey:)]) {
[albumDict
setObject:[NSDictionary dictionaryWithObjectsAndKeys:
[[iPhotoAlbumDict objectForKey:@"AlbumId"] copy], @"AlbumId",
[[iPhotoAlbumDict objectForKey:@"Album Type"] copy], @"AlbumType",
[[iPhotoAlbumDict objectForKey:@"PhotoCount"] copy], @"PhotoCount",
nil]
forKey:[iPhotoAlbumDict objectForKey:@"AlbumName"]];
}
}
[iPhotoDict release];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: [NSMutableDictionary setObject:forKey:] problem
      • From: j o a r <email@hidden>
    • Re: [NSMutableDictionary setObject:forKey:] problem
      • From: Sherm Pendley <email@hidden>
References: 
 >[NSMutableDictionary setObject:forKey:] problem (From: Joachim <email@hidden>)
 >Re: [NSMutableDictionary setObject:forKey:] problem (From: m <email@hidden>)

  • Prev by Date: Re: tableViewSelectionDidChange not being called after selectionShouldChangeInTableView?
  • Next by Date: Re: [NSMutableDictionary setObject:forKey:] problem
  • Previous by thread: Re: [NSMutableDictionary setObject:forKey:] problem
  • Next by thread: Re: [NSMutableDictionary setObject:forKey:] problem
  • Index(es):
    • Date
    • Thread