0

我是 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");
            }

但布尔成功是否定的。为什么?我究竟做错了什么?

更新

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

4

0 回答 0