0

我有以下方法可以读取 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:好的

任何想法为什么?我将不胜感激任何见解)

在此处输入图像描述

4

1 回答 1

0

试试这个:

  1. 清理你的 Xcode 项目;

  2. 从您的 iPad 1 / iOS 5.1 设备中删除该应用程序。

重新构建/运行。

希望这能解决它。

于 2012-12-18T11:43:25.463 回答