Xamarin iOS - Disable Back up and Restore for Application

Wong Wei Loon 11 Reputation points
2022-02-11T06:40:50.203+00:00

I know Android and iOS can back up app’s data files, the backup data is then allowed to be transferred from old device to new device.

For android, I understand that we can disable backups for your application with <application android:allowBackup="false" ... in AndroidManifest.xml file. I wonder if iOS has the same?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,349 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 31,166 Reputation points Microsoft Vendor
    2022-02-14T05:17:38.127+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    iOS has its own Application Sandbox to restrict access to system resources and user data in apps to contain damage if an app becomes compromised, and the contents are backed up by iTunes. I'm afraid there is no such attribute to disable backups like Android, but there are three directories under the application : Documents, Library, tmp. The contents of tmp directory are not backed up by iTunes, the contents of Library directory are never exposed to the user via iTunes, you could also set UIFileSharingEnabled key false to the Info.plist file to disable users to access Documents files. For more details, you could refer to https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/file-system#application-directories

    In addition, you could set the SkipBackup attribute on a file, it will inform the operating system that this file should not be backed up into iCloud. For more details, refer to https://learn.microsoft.com/en-us/dotnet/api/foundation.nsfilemanager.setskipbackupattribute?view=xamarin-ios-sdk-12

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.