iphone: why my in-app purchase product array object index set automatically in alphabetical order

I am working on in-app purchase task in app I done all work currently but I need one help that my product array display in UITableview with sorting in alphabetical but I need display as same a my productIdentifiers how can I do this stuff please help

My issue example below:-

I set my product productIdentifiers like

- (id)init 
{
   NSSet *productIdentifiers = [NSSet setWithObjects:
                                   @"com.myapp.calculation.c",
                                   @"com.myapp.calculation.d",
                                   @"com.myapp.calculation.a",
                                   @"com.myapp.calculation.s",
                                   @"com.myapp.calculation.b",
                                   @"com.myapp.calculation.h",
                                   nil];

    if ((self = [super initWithProductIdentifiers:productIdentifiers])) 
    {                

    }

    return self;
}   

and in tableview data display on cell alphabetical sorting with a b c d h s

but i need it display as same as productIdentifiers like c d a s b h

Please help.

Answers


Expanding on Adam's comment above, if you are trying to display data from a collection class in a table view, you should use an array as the data source, not a set. This is because the objects contained within an NSArray are automatically ordered, based on how the objects are placed into the array, and so will come out in that order. With an NSSet the contents are unordered and thus will come out in any order.

Take a look at Apple's Values and Collections document, which gives details of the three main types of collection class available in Cocoa: NSArray, NSSet and NSDictionary.


Need Your Help

Is it a good practice to build a collection cache?

caching mongodb node.js collections

I'm experiencing with MongoDB with Node.js using the plugin node-mongodb-native. A problem I'm experiencing is the amount of nested callbacks. I'm trying to simplify a few things by lessening the c...

getElementById is not working in opera 12.15

javascript dom element opera getelementbyid

I am using javascript on client-side in my app, I need to get the element based on the id, class and tagname, I am using following code for getting element using id.