Creating a JSONRepresentation of my NSDictionary messes up the order?
Posted
by
Lewion
on Stack Overflow
See other posts from Stack Overflow
or by Lewion
Published on 2011-01-03T15:41:04Z
Indexed on
2011/01/03
15:54 UTC
Read the original article
Hit count: 144
Hi all,
To pass data to my webservice, I create an NSDictionary with the objects and keys I need, and use JSONRepresentation to format it nicely so I can post it to my service.
It all worked fine with the previous version where only 2 parameters were required. An array with listitems, and a UDID.
No I also need to pass a version number because we need to provide more data for people with the application at this new version.
Only problem is when I create my JSONRepresentation now, the order of things are all messed up.
NSMutableDictionary *rowDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:arrayDict,@"basketListV2",sharedData.udid,@"UDID",@"1.4",@"version",nil];
It prints out version first, then UDID and then basketListV2.
Anyone know what I can do to maintain the order of my NSDict? I tried both NSDictionary and NSMutableDictionary (Probably doesn't have to do anything with it but for testing purposes I had to try it.)
Thanks in advance.
Lewion
© Stack Overflow or respective owner