I'm trying to understand how UIDevice.current.identifierForVendor
behaves when an iOS app is restored via iCloud onto a different physical device.
Context
I'm building an app that needs to detect whether it’s running on a newly restored device (for example, after the user transfers their iPhone via iCloud setup).
To do this, I save the value of UIDevice.current.identifierForVendor?.uuidString
in persistent storage (e.g., UserDefaults
).
The question
If I install my app on Device A, store the identifierForVendor
value, back up the device to iCloud,
and then restore that backup onto Device B, will the restored app see the same identifierForVendor
value, or a new one?
More specifically:
- Does iCloud backup/restore preserve the underlying “vendor” ID across devices?
- Is the
identifierForVendor
tied only to the bundle identifier and vendor prefix, or also to the physical device hardware? - If the user deletes all apps from the same vendor, then restores them from iCloud, is the ID reset?
What I’ve found so far
Apple’s docs say:
“The value of this property is the same for apps that come from the same vendor running on the same device.
If the user deletes all of that vendor’s apps from the device and then reinstalls one or more of them, the value may change.”
However, it doesn’t explicitly mention what happens after iCloud restore onto a new device.
Goal
I want to know if it’s safe to use identifierForVendor
to detect a new device context (e.g., trigger a refresh of a Firebase token when the user’s device changes).
Environment
- iOS 17+ (latest)
- Swift / Capacitor app bridge
- Testing between iPhone 14 Pro → iPhone 15 Pro (iCloud restore)