SetNoBackupFlag is not working

I am currently on Unity 5.3.6 and I am trying to mark files with the nobackupflag so that they are not backed up into icloud. My project downloads assets into the persistentDataPath and then saves the file by using System.IO.File.WriteAllBytes. After writing the bytes I call SetNoBackupFlag with the same path that was used to save the file. The problem is that it seems that all of the files still appear as they are going to be backed up into icloud.

My code looks like the following

string savePath = System.IO.Path.Combine(UnityEngine.Application.persistentDataPath, filePath);
System.IO.File.WriteAllBytes(savePath, m_www.bytes);

UnityEngine.iOS.Device.SetNoBackupFlag(savePath);

Any Idea on why the files still want to be backed up?

1 Answer

1

I decided not to use Unity’s function and just created a plugin that will allow me to access the iOS API for this functionality. That solve my problem, I am still not sure why the function provided by unity could not handle this properly