Comments (4)
Ok, thanks for answer. My usage of KeychainAccess:
func getUUID() -> String {
let userDefaults = NSUserDefaults.standardUserDefaults()
if let uuid = userDefaults.objectForKey(Constants.UserDefaults.UUID) as? String {
return uuid
} else {
let keychain = Keychain(service: Constants.Keychain.Service)
if let token = try? keychain.getString(Constants.Keychain.UUID) {
if let tkn = token {
userDefaults.setObject(token, forKey: Constants.UserDefaults.UUID)
return tkn
} else {
return self.generateNewUUID()
}
} else {
return self.generateNewUUID()
}
}
}
func generateNewUUID() -> String {
let userDefaults = NSUserDefaults.standardUserDefaults()
let keychain = Keychain(service: Constants.Keychain.Service)
let UUID = NSUUID().UUIDString
userDefaults.setObject(UUID, forKey: Constants.UserDefaults.UUID)
userDefaults.synchronize()
keychain[Constants.Keychain.UUID] = UUID
return UUID
}
If it is okay you can close this. I am use it this way and for now without problem.
from keychainaccess.
I think that Keychain returns nil is very rare case.
from keychainaccess.
Hi @LiborZ
Did setting the synchronizable to false help prevent the Keychain from being shared among devices through iCloud?
from keychainaccess.
Nope. Is it enought to change in both methods code to:
let keychain = Keychain(service: Constants.KeyChain.Service).synchronizable(false)
or do I need to do more changes? Thanks
from keychainaccess.
Related Issues (20)
- Edit swift code
- Entitlements error while tests HOT 2
- Warning Unnecessary check for macOS
- Keychain
- keychain access
- Purple Error in Xcode 14.3 (14E222b) HOT 1
- brew install pipx pipx ensurepath
- Is there an update on this? This is affecting our production apps.
- update 3.2.3 to 4.2.0,it is crashed ,when play animation
- iCloud
- I can not upload my app due to this issue,
- how to pass items from Keychain between iOS project and watchOS extension app HOT 4
- Does not compile under Xcode 15 and Sonoma HOT 1
- 835706d8afdaf5c437056136ccf38dace4cc13e6
- Any support of Privacy Manifest? HOT 2
- About Privacy Manifest Update Plan HOT 15
- Support App Privacy Manifest HOT 1
- Privacy Manifest File Updation Needed.
- Tagging Releases
- Support Apple Privacy Manifest HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keychainaccess.