So I'm trying to set up data persistence by writing values to a mutable array (NSStrings and floats, all input as NSString). The problem I'm getting is when I try to load them. Loading an NSString into another NSString works fine, but loading an NSString into a float gives me an error. Here's my code:
Saving:
Loading:
Help? Everywhere I look tells me to use floatValue...
Thanks,
-T
Saving:
Code:
[array addObject: name]; //name is an NSString
[array addObject: [NSString stringWithFormat:@"%f", stat]]; //stat is a float
Loading:
Code:
name = [array objectAtIndex:1];
stat = [[array objectAtIndex:3] floatValue]; //ERROR
Help? Everywhere I look tells me to use floatValue...
Thanks,
-T