我有以下方法可以读取 plist 文件[请参阅随附的屏幕截图]并将其作为可变数组返回:
+(NSMutableArray *)getSharersPlistArray:(NSString*)plist
{
NSString *AppDetailPlist = [[NSBundle mainBundle] pathForResource:plist ofType:@"plist"];
NSMutableArray* toReturn = [NSMutableArray arrayWithArray:[NSArray arrayWithContentsOfFile:AppDetailPlist]];
NSLog(@"toReturn:%@", toReturn);
return toReturn;
}
这在 iPad 1 / iOS 5.1 上的不完整结果:
(
{
2 = {
image = "Icon-72.png";
name = Email;
type = ShareCell;
};
},
{
0 = {
image = "Icon-72.png";
name = Share;
type = ShareCell;
};
}
)
在 5.1 或 6.0 模拟器上的正确/完整结果:
(
{
0 = {
image = "Icon-72.png";
name = Facebook;
type = ShareCell;
};
1 = {
image = "Icon-72.png";
name = Twitter;
type = ShareCell;
};
2 = {
image = "Icon-72.png";
name = Email;
type = ShareCell;
};
},
{
0 = {
image = "Icon-72.png";
name = Share;
type = ShareCell;
};
1 = {
image = "Icon-72.png";
name = Follow;
type = ShareCell;
};
}
)
我确实验证了 plist,它看起来不错:
寻找 。-name '*plist' -exec plutil {} \;
./Share.plist:好的
任何想法为什么?我将不胜感激任何见解)