iphone - plist file not being found -


i'm trying write simple array plist file , later on retrieve it. have following code:

+ (nsstring*) datafilepath {     nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentationdirectory, nsuserdomainmask, yes);     nsstring *documentdirectory = [paths objectatindex:0];     nsstring *datafilepath = [documentdirectory stringbyappendingpathcomponent:@"tipalertviewdefaults.plist"];      return datafilepath; }  + (nsarray*) tipalertviewdefaults {     nsstring *datafilepath = [self datafilepath];     nslog(@"datafilepath: %@", datafilepath);     nsmutablearray *tipalertviewdefaults;      if ([[nsfilemanager defaultmanager] fileexistsatpath:datafilepath])     {         nslog(@"file exists");         tipalertviewdefaults = [[nsmutablearray alloc] initwithcontentsoffile:datafilepath];     }     else     {         nslog(@"file doesn't exist");         tipalertviewdefaults = [[nsmutablearray alloc] initwithobjects:[nsnumber numberwithbool:no], nil];         [tipalertviewdefaults writetofile:datafilepath atomically:yes];     }      return tipalertviewdefaults; } 

i call method twice, in first should not find file , write first time. second call should able find file isn't. can see i'm going wrong here?

again, xcode's stupid autocomplete made lost: nsdocumentationdirectory should nsdocumentdirectory.

the documentation directory doesn't exist on ios, can't write there.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -