From the course: Advanced iOS Development: Keychain Access

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Updating values in the keychain

Updating values in the keychain - iOS Tutorial

From the course: Advanced iOS Development: Keychain Access

Start my 1-month free trial

Updating values in the keychain

- [Instructor] So we defined the item that we want changed, the generic password for this username, and the new password. Now we have to set it in the keychain. So I'm going to create a new function above that on line 11, static func update Keychain and it's going to take two parameters. The first will be the query. Again, this is the dictionary of the thing we want to find. And then the second parameter is going to be the attribute. So AATRS and again, string any as the dictionary definition. Again, it will return a bool for success or not. And now we just have to call the function to update the keychain. We want to store that of course so on line 13 I'll type let result equal SEC item update. And we'll pass in our two dictionaries, easy enough. Query and we'll cast that as a CF dictionary. And then also our ATTRS. And again, pass that as a CF dictionary. Now that we have this updating the keychain now we just want to…

Contents