objective c - How to properly init RestKit's objectStore to use directory other than Documents -


so see there init method in restkit's reference: objectstorewithstorefilename:indirectory:usingseeddatabasename:managedobjectmodel:delegate suppose initialize objectstore in specified directory. "indirectory" parameter accepts nsstring. i've tried @"library/caches" , [self.applicationcachesdirectory absoluteurl] self.applicationcachesdirectory returns url of caches directory i'm getting exceptions.

please tell me how can specify "library/caches" in method in order save sqlite db in caches directory instead of documents?

got working. i've created helper method caches folder path nsstring

    - (nsstring *)applicationcachesdirectorystring {     nsarray *paths = nssearchpathfordirectoriesindomains(nscachesdirectory, nsuserdomainmask, yes);     nsstring *cachepath = [paths objectatindex:0];     bool isdir = no;     nserror *error;     if (! [[nsfilemanager defaultmanager] fileexistsatpath:cachepath isdirectory:&isdir] && isdir == no) {         [[nsfilemanager defaultmanager] createdirectoryatpath:cachepath withintermediatedirectories:no attributes:nil error:&error];     }     return cachepath; } 

and passed objectstore init method:

self.objectmanager.objectstore = [rkmanagedobjectstore objectstorewithstorefilename:databasename indirectory:[self applicationcachesdirectorystring] usingseeddatabasename:seeddatabasename managedobjectmodel:managedobjectmodel delegate:self]; 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -