ios - How to pass these parameters into an NSString nsuserdefault -
i have 14 nsuserdefualt save keys , instead of adding 14 of them created loop handle this. getting error says many arguments. having brain fart , forgot something. tips or suggestions appreciated.
edit: trying read saved data.
(int n=0; n==14; n++ ) { nsstring *emailbody=[nsstring stringwithformat:@"enhancers: %@", [[nsuserdefaults standarduserdefaults] stringforkey:@"enhancer%i",n]]; }
you had argument in format string "n" should have been placed in different format stringforkey:. should clear things up:
for (int n=0; n==14; n++ ) { nsstring *stringfromdefaults = [[nsuserdefaults standarduserdefaults] stringforkey:[nsstring stringwithformat:@"%d",n]]; nsstring *emailbody=[nsstring stringwithformat:@"enhancers: %@",stringfromdefaults]; }
Comments
Post a Comment