-(BOOL) Application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {
// Read the Documents directory code
nsarray *pathsdocuments=nssearchpathfordirectoriesindomains(nsdocumentdirectory, Nsuserdomainmask,YES);
nsstring *pathdocuments=[pathsdocuments objectatindex:0];
NSLog (@ "pathdocuments~~~~~~%@ pathsdocuments----%@", pathdocuments,pathsdocuments);
/*
pathdocuments~~~~~~/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/ Data/containers/data/application/12ea0817-d2c0-40e5-b3cc-1eb642fcdf9f/documents pathsDocuments----(
"/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/containers/data/ Application/12ea0817-d2c0-40e5-b3cc-1eb642fcdf9f/documents "
)
*/
// Read the Cache directory code
nsarray *pathscache=nssearchpathfordirectoriesindomains(nscachesdirectory, Nsuserdomainmask,YES);
nsstring *pathcache=[pathscache objectatindex:0];
NSLog (@ "pathcache~~~~~~%@ pathscache----%@", pathscache,pathcache);
/*
Pathcache~~~~~~ (
"/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/containers/data/ Application/823489c8-00da-403b-95ab-76c8fbe8aaaa/library/caches "
) Pathscache----/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/ Containers/data/application/823489c8-00da-403b-95ab-76c8fbe8aaaa/library/caches
*/
// read Library directory
nsarray *pathslibrary=nssearchpathfordirectoriesindomains(nslibrarydirectory, Nsuserdomainmask, YES);
nsstring *pathlibrary=[pathslibrary objectatindex:0];
NSLog (@ "pathslibrary~~~~~~%@ pathlibrary----%@", pathslibrary,pathlibrary);
/*
Pathslibrary~~~~~~ (
"/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/containers/data/ Application/05969a2d-e6bd-4f4b-a57e-4414d987d240/library "
) pathlibrary----/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/ Containers/data/application/05969a2d-e6bd-4f4b-a57e-4414d987d240/library
*/
// Read temp folder
nsstring *tempdir=nstemporarydirectory();
NSLog (@ "tempdir~~~%@", tempdir);
/*
tempdir~~~/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/ containers/data/application/cef70855-6285-46d9-b7bf-b4c9aab1816b/tmp/
*/
// project comes with a . Bundle repository placed in the . Bundle These resources are read-only and cannot be written
nsstring *defaultdbpath=[[nsbundle mainbundle] resourcepath];
NSLog(@ "defaultdbpath~~%@", Defaultdbpath);
/*
defaultdbpath~~/users/yhj/library/developer/coresimulator/devices/65fc33fe-6234-427b-a4f2-4f22ace36842/data/ Containers/bundle/application/d94dd7f5-0ce9-4eef-8e47-37c4737ef2cf/ios sandbox Files directory Description and common operations . App
*/
//To ensure that the contents of the app's documents are not backed up to icloud
[self addskipbackupattributetoitematurl: [nsurl fileurlwithpath:p athdocuments];
return YES;
}
Use the nsurlisexcludedfrombackupkey or kcfurlisexcludedfrombackupkey file properties to prevent files from being backed up. These APIs are additional properties that are set directly through the old, deprecated way. All running on iOS5.1 should use these API packages to prevent files from being backed up. prevent files from being backed up on iOS5.1
-(BOOL) Addskipbackupattributetoitematurl: (nsurl *) URL
{
assert([[nsfilemanager defaultmanager] fileexistsatpath: [URL path]]);
nserror *error=nil;
BOOL success=[url setresourcevalue: [nsnumber numberwithbool:YES] Forkey:nsurlisexcludedfrombackupkey error:&error];
if (!success) {
NSLog(@ "Error excluding%@ from backup%@", [URL lastpathcomponent],error);
}
return success;
}
iOS sandbox files directory descriptions and common operations