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
Post a Comment