--- title: "Logout Device" slug: "mapp-engage-ios-sdk-logout" updated: 2026-05-07T09:32:39Z published: 2026-05-07T09:32:39Z canonical: "docs.mapp.com/mapp-engage-ios-sdk-logout" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Logout Device ## Overview Use the logout API to disassociate the current device from the active user session in Mapp Engage. The SDK clears the user-specific state on the device so that subsequent push notifications and inbox content are no longer tied to the previous user. --- ## Use Case 1. **Purpose**: - End the user-to-device association after the user signs out of the host app. - Optionally control whether the device remains addressable for push after the user is removed. 2. **Benefits**: - Prevent user-targeted notifications from reaching a device after sign-out. - Keep the device addressable for anonymous campaigns when desired. --- ## Implementation Details ### Logout API Call `logoutWithOptin:` on the shared `Appoxee` instance. The method takes a `BOOL` flag (`optin`) that controls whether the device remains subscribed to push after the user is removed from the device. **Swift** ```swift Appoxee.shared()?.logout(withOptin: true)   // device stays opted in Appoxee.shared()?.logout(withOptin: false)  // device is opted out ``` **Objective-C** ```objectivec // Logout the user from the device [[Appoxee shared] logoutWithOptin:YES];   // device stays opted in [[Appoxee shared] logoutWithOptin:NO];    // device is opted out ``` > [!WARNING] > Warning: > > Confirm the exact tenant-side semantics of the `optin` flag with your Mapp Cloud account manager before relying on a specific value. The flag controls the device's subscription status after the user is removed; the precise effect on anonymous push, inbox visibility, and tag retention can depend on tenant configuration. ### Re-enable push for the device If push has been disabled, re-enable it using `disablePushNotifications:` with `NO`: ```swift Appoxee.shared()?.disablePushNotifications(false) { error, data in    if error == nil {        print("Push re-enabled.")    } } ``` ### Clear additional app data on logout Optionally clear cached data and user-specific preferences in the host app: ```swift UserDefaults.standard.removeObject(forKey: "user_data") ``` > [!NOTE] > Keep in mind: > > - `logoutWithOptin:` returns `void` — there is no completion handler for the logout call itself. > - Test both `YES` and `NO` end-to-end against your Mapp Engage tenant to verify the post-logout push and inbox behaviour you expect. > - Inform users when sign-out also affects push subscription on the device.