Maintaining the order while iterating a NSDictionary

前端 未结 3 1894
春和景丽
春和景丽 2021-01-28 01:49

I have a NSDictionary which im iterating and Im saving the datas to core data as follows,

NSDictionary *details = [valueDict objectForKey:@\"shipment_master\"];
         


        
3条回答
  •  伪装坚强ぢ
    2021-01-28 02:28

    NSDictionary is an unordered collection. To say "the order I added them" has no meaning. If you want to access the keys in a certain order then you'll either have to store an array along side your dictionary or get the keys and then sort them and use that to access the values in that order.

提交回复
热议问题