Minimum Deployment Target
tvOS 9.0 or laterPlatform Support
SAMKeychain fully supports tvOS with the same API as iOS. The library is compiled withTARGET_OS_IPHONE defined for tvOS, which means it includes iOS-specific features.
Available Features
Accessibility Types
tvOS supports the same accessibility type configuration as iOS:For tvOS apps,
kSecAttrAccessibleAfterFirstUnlock is generally recommended since tvOS devices are typically always-on and may need background access to keychain items.Access Groups
Access groups are available on tvOS, allowing keychain sharing between apps:Like iOS, access groups do not work in the tvOS Simulator and require testing on physical devices.
iCloud Keychain Synchronization
tvOS supports iCloud Keychain synchronization, which is particularly useful for sharing credentials between your tvOS app and other Apple platforms:Basic Usage
Standard keychain operations work identically to iOS:tvOS-Specific Considerations
User Authentication
tvOS apps often have unique authentication flows due to the TV interface. Consider using iCloud Keychain synchronization to share credentials from iOS/macOS apps:Background Accessibility
tvOS apps may run in the background (e.g., for Top Shelf content). Use appropriate accessibility types:Avoid using
kSecAttrAccessibleWhenUnlocked if your app needs to access keychain items while running in the background on tvOS.Error Handling
tvOS uses the same error handling as iOS:Cross-Platform Development
When developing for both tvOS and other Apple platforms:- Use synchronization - Share credentials via iCloud Keychain across devices
- Match service names - Use the same service identifier across platforms
- Test on devices - Some features like access groups require physical hardware
- Consider UX differences - tvOS has unique input constraints that may affect authentication flows
