Seam.shared.unlock(using:).
Using this process involves the following steps:
- Retrieve available mobile credentials.
- Monitor for permission or credential errors. Unhandled errors are thrown as
credentialErrors([SeamCredentialError]). - Perform the unlock operation.
- Handle unlock status events.
- Cancel the unlock operation if needed.
1. Retrieve Mobile Credentials
Access the current credentials through the publishedcredentials array on Seam.shared:
- iOS Swift
- Android Kotlin
2. Monitor Credential Errors
Permission or setup issues appear in each credential’serrors property. Observe like this:
- iOS Swift
- Android Kotlin
Note: The.errorsarray on credentials represents per-credential issues, though some issues may be repeated across several credentials (for example, bluetooth requirements). SDK- or credential-level errors (such as invalid token or expired credential) are thrown directly by methods likeunlock(using:)becauseSeamErrororSeamCredentialErrorand must be handled throughdo/catch.
3. Perform Unlock Operation
The call toSeam.shared.unlock(using:) may throw:
SeamError: For SDK-level issues (for example, invalid token, uninitialized SDK).SeamCredentialError: For credential-specific issues (for example, expired credential, device not eligible). Ensure that you wrap the call indo/catchblocks to handle these errors.
- iOS Swift
- Android Kotlin
If the Apple Wallet dialog appears when using the BLE unlock, see Handling System Permissions for steps to prevent it and ensure a smoother unlockWithTap experience.
4. Handle Unlock Events
Handle eachSeamUnlockEvent to update your UI and logic. Available events:
- launched
Unlock operation has started. - grantedAccess
Access was granted by the lock. - timedOut
Unlock operation timed out without success. - connectionFailed(debugDescription:)
Unlock operation failed to connect;debugDescriptionmay contain additional details.
- iOS Swift
- Android Kotlin
Async/Await example:Combine example:
5. Cancel the Unlock Operation
Stop scanning by canceling your active task or subscription.- iOS Swift
- Android Kotlin

