//function to get home directory path:NSString *homedir =nshomedirectory ();//ways to get the documents directory path:Nsarray *paths =nssearchpathfordirectoriesindomains (NSDocumentDirectory, Nsuserdomainmask, YES); NSString*docdir = [Paths Objectatindex:0];//to get the caches directory path:Nsarray *paths =nssearchpathfordirectoriesindomains (Nscachesdirectory, Nsuserdomainmask, YES); NSString*cachesdir = [Paths Objectatindex:0];//method to get the TMP directory path:NSString *tmpdir =nstemporarydirectory ();//to obtain the path to the resource file in the application package://For example, get a picture resource (apple.png) path in the package by:NSString *imagepath =[[NSBundle Mainbundle] pathforresource:@ "apple" oftype:@ "PNG"]; UIImage*appleimage =[[UIImage alloc] initwithcontentsoffile:imagepath];//the Mainbundle class method in the code is used to return an object that represents the application package.
IOS Get Sandbox path method