写给plist - 错误

时间:2013-11-14 20:59:17

标签: ios objective-c plist

我是iOS新手。我有一个包含以下内容的plist:

<plist version="1.0">
<dict>
    <key>MsgTest</key>
    <array>
        <dict>
            <key>Order</key>
            <string>Value</string>
        </dict>
    </array>
</dict>
</plist>

我确实想要改变

NSString @"Value"NSString *result=@"Alphabetic". 我做了以下事情:

     plistOrder = [[NSBundle mainBundle] pathForResource:@"PList" ofType:@"plist"];
        orderDictionary = [[NSDictionary dictionaryWithContentsOfFile:plistOrder] mutableCopy];
        SettingArray = [[orderDictionary objectForKey:@"MsgTest"]mutableCopy];

    [SettingMutableDictionary setValue:result forKey:@"Order"];
            [SettingMutableArray replaceObjectAtIndex:0 withObject:SettingDictionary];

             [orderDictionary setValue:SettingArray forKey:@"MsgTest"];

            BOOL success= [orderDictionary writeToFile:plistOrder atomically:YES];
            if (success){
                NSLog(@"!!!!!!!!!!!!!success");
            }

但是bool的成功是否定的。为什么?我做错了什么?

更新

我想要更改数据的plist位于Resource文件夹中。

0 个答案:

没有答案