objective c - Accessing NSDocumentDirectory on iPad Simulator -
i've added simple .csv file app's nsdocumentdirectory using:
-(ibaction)exportmodule:(id)sender{ nsstring *filename = @"exportedfile.csv"; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *exportstring = @"i've,been,exported"; nsdata *testdata=[exportstring datausingencoding:nsutf8stringencoding]; nsstring *docdir = documentsdirectory; nsstring *completepath = [docdir stringbyappendingpathcomponent:filename]; [testdata writetofile:completepath atomically:yes]; if ([[nsfilemanager defaultmanager] fileexistsatpath:completepath]) { nslog(@"theres file here!"); } }
the app gets if statement printing "theres file here!"
, open file , see if there problems in formatting .csv.
if running on physical device, i'd able open in itunes , take there, there way examine .csv while using simulator?
i have @ beginning of of programs using simulator
nslog(@"documents: %@", [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]);
Comments
Post a Comment