ios - Add data from plist to NSSet? -


i trying add product ids in app purchase. here in following code adding manually. how can add plist?

my code:

@implementation rageiaphelper  + (rageiaphelper *)sharedinstance {     static dispatch_once_t once;     static rageiaphelper * sharedinstance;     dispatch_once(&once, ^{         nsset * productidentifiers = [nsset setwithobjects:                                       @"greatminds.assamkarttestingdays",                                       @"greatminds.newgirlinthecity",                                       @"greatminds.newlights",                                       nil];         sharedinstance = [[self alloc] initwithproductidentifiers:productidentifiers];     });     return sharedinstance; } 

setup plist array. load nsarray plist file. create nsset nsarray.

// assume have plist in app bundle named "products.plist" root of type array nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"products" oftype:@"plist"]; nsarray *products = [nsarray arraywithcontentsoffile:filepath]; nsset *productidentifiers = [nsset setwitharray:products]; 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -