SAMKeychain requires ARC (Automatic Reference Counting) to be enabled in your project.
Installation Methods
CocoaPods
Carthage
Add framework to project
Drag the built
SAMKeychain.framework from Carthage/Build to your project’s “Linked Frameworks and Libraries” section in Xcode.Add run script
Add a new Run Script Phase in your target’s Build Phases:Add the framework path to “Input Files”:
Manual Installation
If you prefer not to use a dependency manager, you can manually add SAMKeychain to your project.Download source files
Download or clone the SAMKeychain repository from GitHub.
Add files to project
Add the following files from the
Sources directory to your Xcode project:SAMKeychain.hSAMKeychain.mSAMKeychainQuery.hSAMKeychainQuery.m
Add Security framework
Add the
Security.framework to your target:- Select your project in the Project Navigator
- Select your target
- Go to the “General” tab
- Scroll to “Frameworks, Libraries, and Embedded Content”
- Click the ”+” button
- Search for and add
Security.framework
Verification
To verify that SAMKeychain is correctly installed, try building your project. You should be able to import and use SAMKeychain without any errors:Platform-Specific Notes
macOS
No additional configuration is required for macOS. The Security framework is available on macOS 10.8 and later.iOS, tvOS, and watchOS
For iOS, tvOS, and watchOS, you can configure keychain accessibility and access groups:Access Groups (iOS)
If you need to share keychain data between apps, configure access groups in your entitlements file and useSAMKeychainQuery:
Troubleshooting
Build fails with 'Security/Security.h' not found
Build fails with 'Security/Security.h' not found
Make sure the Security framework is added to your target. See the manual installation steps above.
ARC-related errors
ARC-related errors
Duplicate symbol errors
Duplicate symbol errors
You may have included SAMKeychain through multiple methods (e.g., both CocoaPods and manual installation). Choose one installation method and remove the other.
Next Steps
Quick Start Guide
Now that SAMKeychain is installed, learn how to use it with our quick start guide.
