无法在uipickerview中显示plist

时间:2012-07-09 11:38:19

标签: xcode ios4 plist

我有一个像这样的plist:

<plist version="1.0">
<dict>
    <key>activities</key>
    <array>
        <string>sleeping</string>
        <string>eating</string>
        <string>working</string>
    <string>thinking</string>
        <string>crying</string>
        <string>begging</string>
        <string>leaving</string>
        <string>shopping</string>
        <string>hello worlding</string>
    </array>
    <key>feelings</key>
    <array>
        <string>awesome</string>
        <string>sad</string>
        <string>happy</string>
        <string>ambivalent</string>
        <string>nauseous</string>
        <string>psyched</string>
        <string>confused</string>
        <string>hopeful</string>
        <string>anxious</string>
    </array>
</dict>
</plist>

当我尝试读取内容并在控制台中显示时,我得到一个(null):

plistData_ = [[NSDictionary alloc] initWithContentsOfFile:plistPath_];
NSLog(@"plistData_: %@", plistData_);

其中

plistPath_ = [self dataFilePath];

dataFilePath:

- (NSString *)dataFilePath {
    NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentDirectory = [path objectAtIndex:0];
    return [documentDirectory stringByAppendingPathComponent:@"items.plist"];
}

我哪里错了?

0 个答案:

没有答案