|
| 1 | +--- |
| 2 | +id: ios-keychain-cleanup |
| 3 | +title: Support for iOS keychain cleanup and access groups |
| 4 | +sidebar_label: iOS Keychain Cleanup |
| 5 | +description: Secure and clean iOS testing with LambdaTest's iOS Keychain cleanup and seamless access group handling support. |
| 6 | +keywords: |
| 7 | + - appium |
| 8 | + - manual testing |
| 9 | + - keychain |
| 10 | + - access group |
| 11 | + - cleanup |
| 12 | + - app testing |
| 13 | + - real devices |
| 14 | +image: /assets/images/og-images/appium-testing-og-image.jpg |
| 15 | +url: https://www.lambdatest.com/support/docs/ios-keychain-cleanup/ |
| 16 | +site_name: LambdaTest |
| 17 | +slug: ios-keychain-cleanup/ |
| 18 | +--- |
| 19 | + |
| 20 | +import CodeBlock from '@theme/CodeBlock'; |
| 21 | +import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; |
| 22 | +import RealDeviceTag from '../src/component/realDevice'; |
| 23 | +import VirtualDeviceTag from '../src/component/virtualDevice'; |
| 24 | + |
| 25 | +<script type="application/ld+json" |
| 26 | + dangerouslySetInnerHTML={{ __html: JSON.stringify({ |
| 27 | + "@context": "https://schema.org", |
| 28 | + "@type": "BreadcrumbList", |
| 29 | + "itemListElement": [{ |
| 30 | + "@type": "ListItem", |
| 31 | + "position": 1, |
| 32 | + "name": "Home", |
| 33 | + "item": "https://www.lambdatest.com" |
| 34 | + },{ |
| 35 | + "@type": "ListItem", |
| 36 | + "position": 2, |
| 37 | + "name": "Support", |
| 38 | + "item": "https://www.lambdatest.com/support/docs/" |
| 39 | + },{ |
| 40 | + "@type": "ListItem", |
| 41 | + "position": 3, |
| 42 | + "name": "iOS Keychain Cleanup", |
| 43 | + "item": "https://www.lambdatest.com/support/docs/ios-keychain-cleanup/" |
| 44 | + }] |
| 45 | + }) |
| 46 | + }} |
| 47 | +></script> |
| 48 | + |
| 49 | +Apple’s [Keychain](https://developer.apple.com/documentation/security/keychain_services) offers a secure system for apps to store sensitive information like passwords, certificates, authentication tokens, and other small data pieces. |
| 50 | +LambdaTest now offers enhanced Keychain management on real iOS devices, enabling you to test app flows that rely on secure storage and Keychain-specific use cases more effectively. |
| 51 | + |
| 52 | +## Keychain Cleanup After Sessions |
| 53 | + |
| 54 | +Certain iOS apps may retain user data such as login details across different test sessions. |
| 55 | +This happens because when an app is uninstalled, any Keychain data associated with it **remains on the device**, as iOS does not automatically clear it. |
| 56 | +While this data is isolated from other apps, it can persist unless specifically removed. |
| 57 | + |
| 58 | +To prevent data from carrying over across sessions, LambdaTest offers an option to automatically clear all Keychain entries after your test ends — ensuring a clean environment for every run. |
| 59 | + |
| 60 | +## Keychain Access Groups During App Resigning |
| 61 | + |
| 62 | +When LambdaTest resigns your iOS application using a wildcard provisioning profile (to enable installation on real devices), the app’s **keychain-access-groups** entitlement is preserved. |
| 63 | +However, the **Bundle Seed ID** (also known as Team ID) — a critical part of access groups — gets replaced during resigning. |
| 64 | + |
| 65 | +As a result, app functionalities that depend on the original access group may break if not handled properly. |
| 66 | +By enabling Keychain support, LambdaTest takes care of these changes, allowing your app to continue using Keychain securely even after resigning. |
| 67 | + |
| 68 | + |
| 69 | +>This feature is currently in **Beta**. We are actively refining it based on real-world usage and feedback. |
| 70 | +
|
| 71 | +## How to Enable iOS Keychain Support During App Upload |
| 72 | + |
| 73 | +To activate Keychain cleanup and access group handling, simply pass the `ios_keychain_enabled` parameter during app upload. |
| 74 | + |
| 75 | +Example using **cURL**: |
| 76 | + |
| 77 | +```bash |
| 78 | +curl -u "USERNAME:ACCESS_KEY" \ |
| 79 | +-X POST "https://manual-api.lambdatest.com/app/upload/realDevice" \ |
| 80 | +-F "appFile=@/path/to/your-app.ipa" \ |
| 81 | +-F "name=YourAppName" \ |
| 82 | +-F "ios_keychain_enabled=true" |
| 83 | +``` |
| 84 | +Enabling `ios_keychain_enabled=true` will |
| 85 | +- Clear Keychain data after each test session. |
| 86 | +- Preserve Keychain access across resigning. |
| 87 | + |
| 88 | + |
| 89 | +:::note |
| 90 | +- Supported on **iOS 13 and above** only. Apps targeting earlier iOS versions are not compatible. |
| 91 | +- Requires app resigning (`resignApp=true`). Apps signed with **Enterprise certificates** are not supported. LT framework needs to be injected in this case. |
| 92 | + |
| 93 | +::: |
| 94 | + |
| 95 | +## Frequently Asked Questions (FAQs) |
| 96 | + |
| 97 | +### 1. Can Keychain cleanup be managed without `ios_keychain_enabled`? |
| 98 | + |
| 99 | +Yes. Developers have the following options: |
| 100 | +- Proactively delete Keychain entries during user logout or similar app events. |
| 101 | +- Reset all Keychain data during the app's first launch after installation. |
| 102 | + |
| 103 | +You can refer to Apple's guide for best practices: [Manage Keychain Data](https://developer.apple.com/documentation/security/keychain_services). |
| 104 | + |
| 105 | +Additionally, apps can provide an in-app setting to manually clear Keychain data if needed during testing. |
| 106 | + |
| 107 | +--- |
| 108 | + |
| 109 | +### 2. Can Keychain access groups be handled without `ios_keychain_enabled`? |
| 110 | + |
| 111 | +Yes. |
| 112 | +Developers can dynamically retrieve the access group information (`kSecAttrAccessGroup`) from existing Keychain entries instead of hardcoding Bundle Seed IDs. |
| 113 | + |
| 114 | +This approach ensures your app remains functional even if the Team ID changes after resigning. |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +<nav aria-label="breadcrumbs"> |
| 119 | + <ul className="breadcrumbs"> |
| 120 | + <li className="breadcrumbs__item"> |
| 121 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com"> |
| 122 | + Home |
| 123 | + </a> |
| 124 | + </li> |
| 125 | + <li className="breadcrumbs__item"> |
| 126 | + <a className="breadcrumbs__link" target="_self" href="https://www.lambdatest.com/support/docs/"> |
| 127 | + Support |
| 128 | + </a> |
| 129 | + </li> |
| 130 | + <li className="breadcrumbs__item breadcrumbs__item--active"> |
| 131 | + <span className="breadcrumbs__link"> |
| 132 | + iOS Keychain Cleanup |
| 133 | + </span> |
| 134 | + </li> |
| 135 | + </ul> |
| 136 | +</nav> |
0 commit comments