What is the lifeCycle of a .plist file

I am totally confused while using a plist file.

Can anyone explain me the lifecycle of the .plist file.

If I create a .plist file programmatically and add some data in it. and if i close my app (completely not deleting it) does my .plist file will get lost and i have to recreate it.?

I have this code

            -(void)WriteFileToPlist:(int) num
{    
//write everything in the plist

    NSString *errorDesc;
    NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:strArray format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorDesc];
    if (plistData) {
        [plistData writeToFile:[self savePathForFile:num] atomically:YES];            
    }
}

//save the path
-(NSString *) savePathForFile:(int) num
{
    NSArray *pathArray = 
    NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"myPlist%d.plist",num]];
}

question is where the file myPlist get stored. closing the app will delete this plist or not.??

Answers


It's simply a file stored on the device. If you save it in the right folder (for example, not a Cache folder) it'll stay there, just like any other file you can save.


Need Your Help

JDom on Android: error opening trace file: No such file or directory

java android xml jdom

I don't understand why I'm getting this error, I'm trying to write to a file, not read from it. At first I got an error because I didn't put a jar in the libs folder, now I am getting this error. H...

Oracle: Run an Update Trigger Without Changing Data

oracle triggers

Is there a way in Oracle to fire an update trigger without actually changing any data?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.