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

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -