我的朋友和我正在开发一款益智游戏,可以从属性列表中加载其等级数据。我们的问题似乎是,对于某些字典键,它会正确加载数据,但对于其他字典键却没有。此外,更改属性列表往往会导致它无法正确加载。
我的猜测是,这与设备缓存属性列表数据有关,但我不确定。我们几乎尝试了我们和互联网所能想到的一切,但无济于事。 (即在属性列表更改之间删除模拟器和物理设备上的应用程序等)。
我很乐意分享任何人认为可能有助于得出答案的相关代码,我只是不确定哪些是相关的。所以,让我知道你需要什么。
提前致谢。
这是属性列表
<?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">
<dict>
<key>level99</key>
<dict>
<key>xDimension</key>
<integer>19</integer>
<key>yDimension</key>
<integer>7</integer>
<key>levelArray</key>
<array>
<string>E</string>
<string>*</string>
<string>R</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>E</string>
<string>B</string>
<string>E</string>
<string>R</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>E</string>
<string>*</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>*</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>B</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>B</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>R</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>B</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>R</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>E</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>E</string>
<string>E</string>
</array>
</dict>
<key>level10</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>B</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
</array>
</dict>
<key>level0</key>
<dict>
<key>yDimension</key>
<integer>5</integer>
<key>xDimension</key>
<integer>5</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
</array>
</dict>
<key>level1</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
</array>
</dict>
<key>level2</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
</array>
</dict>
<key>level3</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
</array>
</dict>
<key>level4</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
</array>
</dict>
<key>level5</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>B</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
</array>
</dict>
<key>level6</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
</array>
</dict>
<key>level7</key>
<dict>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
</array>
</dict>
<key>level9</key>
<dict>
<key>levelArray</key>
<array>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>B</string>
<string>R</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>B</string>
<string>B</string>
<string>*</string>
<string>B</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>*</string>
<string>Y</string>
<string>*</string>
</array>
<key>xDimension</key>
<integer>5</integer>
<key>yDimension</key>
<integer>8</integer>
<key>didBeat</key>
<false/>
</dict>
<key>level8</key>
<dict>
<key>didBeat</key>
<false/>
<key>yDimension</key>
<integer>8</integer>
<key>xDimension</key>
<integer>5</integer>
</dict>
</dict>
</plist>
这是加载属性列表的代码
-(NSDictionary *)getLevelDictionaryForLevel:(int)level{
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"Group1.plist"];
NSDictionary *plistData = [[NSDictionary alloc] initWithContentsOfFile:finalPath];
NSDictionary *currentLevelData = [plistData objectForKey:[NSString stringWithFormat:@"level%i", level]];
return currentLevelData;
}
答案 0 :(得分:0)
感谢@rmaddy和@Jugale提供有关进一步讨论的建议和问题。我想花一点时间回复并说错误(不幸的是,可能是可预测的)与引用属性列表数据的方式无关。
我们的代码处理构建瓷砖网格并缩放它的方式是错误的。
再次感谢所有的帮助!