how to delete contents from plist programmatically ?

Posted by srikanth rongali on Stack Overflow See other posts from Stack Overflow or by srikanth rongali
Published on 2010-05-01T11:37:30Z Indexed on 2010/05/01 13:27 UTC
Read the original article Hit count: 420

Filed under:
|
|

I have a plist file. I want to delete the data from the plist. How can I do it programmatically ?

My Plist have an array cells. cells is filled by dictionaries . Each dictionary is filled by string.

I used the following way.

    NSString* plistPath1 = [[NSBundle mainBundle] pathForResource:@"details" ofType:@"plist"];

[cells removeObjectAtIndex:[clickedButtonPath row]];
    NSMutableArray *array1 = [[NSMutableArray alloc] initWithCapacity:4];
array1 = cells;
   [array1 writeToFile:plistPath1 atomically: YES];  

But the plist is not taking the changes.

Thank you.

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about iphone-sdk-3.0