i have a plist with an array that contain 2 strings see image :
http://imageshack.us/photo/my-images/263/myplist.png/
and in my viewDidLoad
i add this :
NSString *file = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
NSArray *array = [NSArray arrayWithContentsOfFile:file];
NSLog(@"array = %@", array);
But i got always null
why? Thanks for help.
UPDATE : the solution is that you need to manually edit the plist file (Xcode4 use Dictionnary by default)
<?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>
<array>
<string>HO</string>
<string>HI</string>
</array>
</array>
</plist>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…