Why does my plist file exist even when I've uninstalled an app and wiped the simulator?

Posted by just_another_coder on Stack Overflow See other posts from Stack Overflow or by just_another_coder
Published on 2010-05-04T12:41:07Z Indexed on 2010/05/29 22:22 UTC
Read the original article Hit count: 188

Filed under:

I am trying to detect the existence of a plist file on application start. When my data class (descendant of NSObject) is initialized, it loads the plist file.

Before it loads, it checks to see if the file exists, and if it doesn't, it sets the data = nil instead of trying to process the array of data in the plist file.

However, every time it starts it indicates the file exists. Even when I uninstall the app in the organizer and when wiping the simulator directory (iPhone Simulator/3.0/Applications).

I have the following static method in a library class named FileIO:

+(BOOL) fileExists:(NSString *)fileName {
    NSString *path = [FileIO getPath:fileName]; // gets the path to the docs directory
    if ([[NSFileManager defaultManager] fileExistsAtPath:path]) return YES;
    else return NO;
}

In my data class:

//if( [FileIO fileExists:kFavorites_Filename] ) [FileIO deleteFile:kFavorites_Filename];
if ([FileIO fileExists:kFavorites_Filename]) {NSLog(@"exists");

The "exists" is logged every time unless I un-comment the method to delete the file.

How can the file exist if I've deleted the app? I've deleted the simulator directory and uninstalled on the device but both say it still exists.

What gives???

© Stack Overflow or respective owner

Related posts about iphone