[OGo-Developer] stuffing an NSArray into a NSMutableDictionary
Adam Tauno Williams
developer@opengroupware.org
Tue, 17 Apr 2007 08:26:13 -0400
--=-ytTWwbuPpWMdlWKSAK2Q
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
> > my initial plan was to enumerate over the self->multipleReturn array, s=
tuff=20
> > everything into a dictionary, and then put the dictionary into an array=
.
> > NSMutableDictionary queuesdict;
> > queuesdict =3D [[NSMutableDictionary alloc] init];
> > e =3D [self->multipleReturn objectEnumerator];
> > while ((event =3D [e nextObject])) {
> > if ([[event objectForKey:@"Event"] hasSuffix:@" QueueParams"]) {
> > /* the queue description, their parameters */
> > [queuesdict addObject:event forKey:[event objectForKey:@"Queue"=
]];
> > } else {
> > /* queue members */
> > [[queuesdict objectForKey:[event objectForKey:@"Queue"]=20
> > objectForKey:@"Agents"] addObject:event];
> > [membersarray addObject:event];
> > }
> > }
> > but I am unable to get the Agents stuffed into the dictionary. I do not=
get=20
> > error messages, nothing, it just does not add the Agents to the Diction=
ary.
> > It seems I do not yet understand completely how Mutable dictionaries or=
=20
> > arrays are supposed to work.
> > Any more insights are highly appreciated.
Have you tried adding some log messages to see if you actually end up
within your while/if statements as you expect? =20
Most while statements I've seen using an NSEnumerator look like -
while ((o =3D [enumerator nextObject]) !=3D nil)
{
}
--=-ytTWwbuPpWMdlWKSAK2Q
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQBGJLzkLRePpNle04MRAhX7AJ9aE0HCic0t3OrLyP2tTG6m1100PwCeLC2+
OjcNGcmOVs77JzpDfQuZ26w=
=Bryz
-----END PGP SIGNATURE-----
--=-ytTWwbuPpWMdlWKSAK2Q--