ios - Will files copied to the Document folder of an extension be backup by default on iPhone? -


i writing keyboard extension ios 8. sqlite database copied bundle document folder when keyboard started first time (not previous copy of file exists):

nsstring *docpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; nsstring *dbpath = [docpath stringbyappendingpathcomponent:@"work.sqlite3"]; nsstring *bundlepath = [[nsbundle mainbundle] pathforresource:@"default"                                                         oftype: @"sqlite3"]; [[nsfilemanager defaultmanager] copyitematpath:bundlepath                                          topath:dbpath error:nil]; 

in case user restores backup of iphone new iphone in future, work.sqlite3 file restored in new iphone?

in place of

nsstring *docpath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0]; 

use

func getthefilepath() -> string     {         var url = nsfilemanager.defaultmanager().containerurlforsecurityapplicationgroupidentifier("group.groupbundleid") nsurl?         var path = url?.absolutestring?.stringbyappendingpathcomponent("work.sqlite3") string?         path = path!.stringbyreplacingoccurrencesofstring("file:", withstring: "", options: nsstringcompareoptions.literalsearch, range: nil)          return path!     } 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -