我无法访问放置在此 plist 中的数组:
<?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>
<dict>
<key>PageTitle</key>
<string>Title</string>
<key>Filters</key>
<array>
<dict>
<key>Filter</key>
<string>SomeFilter</string>
<key>Param</key>
<string>SomeParam</string>
</dict>
<dict>
<key>Filter</key>
<string>SomeFilter2</string>
<key>Param</key>
<string>SomeParam2</string>
</dict>
</array>
</dict>
</array>
</plist>
我的代码如下(路径已正确设置):
NSMutableArray* propertyFile = [[NSMutableArray alloc] initWithContentsOfFile:path];
NSMutableDictionary* dict = [propertyFile objectAtIndex:0];
NSMutableArray* filters = [dict[@"Filters"] mutableCopy];
'dict' 变量仅返回一个键/值对,即 'PageTitle' 键。“过滤器”键未被识别。对 iOS 来说非常新,似乎正在旋转我的轮胎试图解决这个问题。