Saltar al contenido

Persistent Device ID (Keychain)

Este contenido aún no está disponible en su idioma.

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 to

By 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 to

The module automatically detects the app environment and behaves differently:

EnvironmentPersistent HWID
SimulatorEnabled
Debug/DevelopmentEnabled
TestFlightEnabled
App StoreDisabled

Installation

Anchor link to

Swift Package Manager

Anchor link to

Add PushwooshKeychain to your target when integrating the Pushwoosh SDK:

  1. In Xcode, go to File → Add Package Dependencies
  2. Enter the package URL: https://github.com/Pushwoosh/Pushwoosh-XCFramework
  3. Select PushwooshKeychain in addition to the required frameworks
  • PushwooshFramework
  • PushwooshCore
  • PushwooshBridge

Add the Keychain subspec to your Podfile:

target 'MyApp' do
use_frameworks!
pod 'PushwooshXCFramework'
pod 'PushwooshXCFramework/PushwooshKeychain'
end

Then run:

Terminal window
pod install

No code changes required. Once you add the PushwooshKeychain module to your project, it works automatically:

  1. On first app launch, the module generates an HWID and stores it in the Keychain
  2. On subsequent launches (including after reinstall), the module retrieves the stored HWID
  3. The SDK uses this persistent HWID for device registration with Pushwoosh

The 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 to

Verifying the module is active

Anchor link to

Check the Xcode console logs when your app launches. You should see a log message like:

[Pushwoosh] Detected environment: Debug. Persistent HWID: ENABLED

or

[Pushwoosh] Detected environment: App Store. Persistent HWID: DISABLED

Clearing the stored HWID

Anchor link to

If you need to reset the persistent HWID during development, you can call:

import PushwooshFramework
// Clear the stored HWID from Keychain
Pushwoosh.Keychain.clearPersistentHWID()