In swift, this code generate a random uuid...
let uuid = UUID().uuidString
I have it so when I click on a button, it gets the uuid and prints it to the console, however, when I click the button once more, I get a different uuid. I want to be able to save the UUID that I get on the first click of the button to a string... Is that possible? Thanks!
UUID is always return value.
If you want to only one time for your application, then you have to stored into iPhone Keychain. Check out Keychain tutorial.
Follow the steps to to stored into Keychain: 1) Get data from Keychain.
2) If you don't get data then generate new UUID and stored into Keychain and use it.
3) If you get UUID then directly use it.
You can kaychain demo and demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With