Persistent Device ID (Keychain)
The PushwooshKeychain module provides persistent device identification (HWID) that survives app reinstallation. This is useful for testing and development scenarios where you need to maintain the same device identity even after reinstalling the app.
How it works
Anchor link toBy default, iOS generates a new identifierForVendor (IDFV) each time an app is reinstalled, which results in a new HWID being registered with Pushwoosh. The PushwooshKeychain module stores the HWID in the iOS Keychain, which persists across app reinstalls.
Environment detection
Anchor link toThe module automatically detects the app environment and behaves differently:
| Environment | Persistent HWID |
|---|---|
| Simulator | Enabled |
| Debug/Development | Enabled |
| TestFlight | Enabled |
| App Store | Disabled |
Installation
Anchor link toSwift Package Manager
Anchor link toAdd PushwooshKeychain to your target when integrating the Pushwoosh SDK:
- In Xcode, go to File → Add Package Dependencies
- Enter the package URL:
https://github.com/Pushwoosh/Pushwoosh-XCFramework - Select
PushwooshKeychainin addition to the required frameworks
PushwooshFrameworkPushwooshCorePushwooshBridge
PushwooshKeychain— Persistent device IDPushwooshLiveActivities— Live Activities supportPushwooshVoIP— VoIP push notificationsPushwooshForegroundPush— Custom foreground notifications
CocoaPods
Anchor link toAdd the Keychain subspec to your Podfile:
target 'MyApp' do use_frameworks!
pod 'PushwooshXCFramework' pod 'PushwooshXCFramework/PushwooshKeychain'endThen run:
pod installUsage
Anchor link toNo code changes required. Once you add the PushwooshKeychain module to your project, it works automatically:
- On first app launch, the module generates an HWID and stores it in the Keychain
- On subsequent launches (including after reinstall), the module retrieves the stored HWID
- The SDK uses this persistent HWID for device registration with Pushwoosh
Use cases
Anchor link toThe PushwooshKeychain module is particularly useful for:
- QA testing — Maintain the same device identity across multiple app installs during testing
- Development — Keep consistent device targeting while iterating on your app
- TestFlight beta testing — Track the same beta testers across app updates and reinstalls
Troubleshooting
Anchor link toVerifying the module is active
Anchor link toCheck the Xcode console logs when your app launches. You should see a log message like:
[Pushwoosh] Detected environment: Debug. Persistent HWID: ENABLEDor
[Pushwoosh] Detected environment: App Store. Persistent HWID: DISABLEDClearing the stored HWID
Anchor link toIf you need to reset the persistent HWID during development, you can call:
import PushwooshFramework
// Clear the stored HWID from KeychainPushwoosh.Keychain.clearPersistentHWID()@import PushwooshFramework;
// Clear the stored HWID from Keychain[Pushwoosh.Keychain clearPersistentHWID];