I'm storing 2 strings in a plist for preferences. When I try to pull the values out and use them in a comparison, they don't seem to be working. No matter what the values it keeps popping to the else block. I have a feeling I'm missing something obvious (been a long day).
Here is the structure of the plist:
Code:
NSArray *values = [[NSArray alloc] initWithContentsOfFile:myPath]; //loads plist
//dirty way of converting string to bool
if ([values objectAtIndex:0] == @"YES") {
paid.on = YES;
} else {
paid.on = NO;
}
NSLog([values objectAtIndex:1]); //make sure I'm not crazy and pulling the wrong value
//Quick note: just using == 8 didn't work either.
if ([values objectAtIndex:1] == @"8") {
switchInternal.selectedSegmentIndex = 0;
} else {
switchInternal.selectedSegmentIndex = 1;
}
Here is the structure of the plist:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>YES</string>
<string>8</string>
</array>
</plist>