Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if iOS app restored from iCloud backup

Tags:

ios

backup

icloud

Is there any way to detect if the launch is from a iCloud backup? (restored)

I have looked here but there is nothing about it.

Their rules about what is allowed to backup is very strict(rejected multiple times for it) backing a database up, with just one user-generated change in it - now I have to back the data up somewhere else and reinsert it on restore from backup.

like image 208
Morten Holmgaard Avatar asked May 18 '15 14:05

Morten Holmgaard


1 Answers

https://developer.apple.com/documentation/security/ksecattraccessiblealwaysthisdeviceonly

Keychain items can be marked as not to be backed up by using one of the accessible attribute with “ThisDeviceOnly”.

You could write a flag to NSUserDefaults and Keychain (Using kSecAttrAccessibleAlwaysThisDeviceOnly), whenever the keychain item is missing but the user defaults value is present (or a backed up keychain item) then it must have been restored from backup. Be aware of secure and not secure iTunes backups as a scenario too. Insecure backups shouldn’t have any keychain items.

like image 176
Ashton-W Avatar answered Sep 20 '22 21:09

Ashton-W