我正在尝试读取包含数组的 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">
<dict>
<key>key1</key>
<string>value1</string>
<key>key2</key>
<string>value2</string>
<key>keyarray1</key>
<array>
<string>keyitem1</string>
<string>keyitem2</string>
</array>
</dict>
</plist>
当我尝试读取 valueForKey:@"keyarray1" 时,我得到空值。我试着读成字符串和数组,螺母没用。
我的代码
NSDictionary * values=[[NSDictionary alloc] initWithContentsOfFile:@"values.plist"];
NSArray *arrayValues=[[NSArray alloc] initWithArray:[values valueForKey:@"keyarray1"]];