Project: titanium
Issue TIMOB-23141: iOS: Ti.Filesystem.File.remoteBackup = true doesn't (re)include file to be backed up
If you never use the Ti.Filesystem.File.remoteBackup property or Ti.Filesystem.File.setRemoteBackup method, then files are properly included in iTunes/iCloud backups as default. So far, so good. If however, like I did in my project, you manually set remoteBackup = true or call setRemoteBackup(true) on a file to doubly make sure it gets backed up, it actually becomes excluded. I've had reports from users that their copy of my app (live on the App Store) was not fully restoring their data from a backup. The files I'd set the flag = true on were some .png's in /Documents and a SQLite database in /Library/Private Documents, but I think the problem is evident for any files. I delved into the SDK code for 5.2.1 and located remoteBackup in TiFilesystemFileProxy.m - after a bit of Googling I noticed that how the method works by calling {code:java} setxattr() {code} is now obsolete. Apple states that from iOS 5.1 you should be doing it this way: [https://developer.apple.com/library/ios/qa/qa1719/_index.html] I modified my copy of TiFilesystemFileProxy.m to work this way and next time I called setRemoteBackup(true) the file was properly marked for backup, i.e. {{NSURLIsExcludedFromBackupKey}} is set to {{NO}}. I tested this against a local iTunes backup. You can check the contents of an iTunes backup using the Terminal command: {noformat} /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/AppleMobileDeviceHelper.app/Contents/Resources/AppleMobileBackup --list {noformat} Prior to my temporary Obj-C code fix my files were not listed in the backup. After adding my fix the files were listed in the backup correctly.
Story points: 3