ios - .realm file automatically backed up by iCloud -
my app rejected because of size of content uploads icloud. file in app's documents folder default.realm database file. think file icloud uploading. how can prevent icloud upload database icloud?
thanks.
according app backup best practices section of ios app programming guide, <application_data>/library/caches
or <application_data>/tmp
not backup icloud. generally, can use <application_data>/library/caches
directory save data won't backup icloud.
to change file path of realm, can pass path
parameter when creating realm instance, below:
let realmpath = nssearchpathfordirectoriesindomains(.cachesdirectory, .userdomainmask, true)[0] as! string let realm = realm(path: realmpath.stringbyappendingpathcomponent("data.realm"))
otherwise, can use nsurlisexcludedfrombackupkey
file system property exclude files , directories backups (see technical q&a qa1719). if want use default path, there way exclude realm file backups.
let realm = realm() if let realmpathurl = nsurl(fileurlwithpath: realm.path) { realmpathurl.setresourcevalue(nsnumber(bool: true), forkey: nsurlisexcludedfrombackupkey, error: nil) }
Comments
Post a Comment