Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MrCrispy

macrumors member
Original poster
Apr 10, 2008
71
0
Jacksonville, Florida
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).

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>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.