I am new to iOS. I have a plist that contains:
<plist version="1.0">
<dict>
<key>MsgTest</key>
<array>
<dict>
<key>Order</key>
<string>Value</string>
</dict>
</array>
</dict>
</plist>
I do want to change the
NSString @"Value"
with : NSString *result=@"Alphabetic".
I did the following:
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");
}
but the bool success is NO. Why? What am I doing wrong?
UPDATE
The plist in which I want to change data is in Resource folder.