Learn about how to handle returned data if and when data is found. It's important to be able to access the data, if any, correctly based on what was searched for.
- [Instructor] On line 19 I want to optionally bind that … with the guard. … So I'll say guard let theItem equal item as … a dictionary of String:Any. … And I'm going to use that optional as, … so I'll add a question mark after it. … Now that we know we have the item as a dictionary, … I can continually optionally bind things with let pwData, … and I can get this out of the item. … So I'll have item open, square brackets, kSecValueData. … The same key that we used … when we created our query to store it. … And I'll cast that as a string … and make sure that we got that back as a data. … And if we have that, … we can decode that back to a string. … So I'll say let password equal string … and pass in the data. … So I'm going to use the initializer that takes the data … and pass in pwData … and use the same encoding we used before, utf8. … And then if we got the password I want to return it. … But we can also get out the account … since we are returning back all the attributes. … So I'm going to say let account equal theItem …
Author
Released
1/23/2020- Creating keychain queries
- Storing generic passwords
- Retrieving data from the keychain
- Handling search results
- Updating and deleting keychain values
- Working with keychain access groups
Skill Level Advanced
Duration
Views
Related Courses
-
iOS Development: Security
with Károly Nyisztor2h 6m Intermediate -
Biometric Authentication for iOS in Swift
with Bear Cahill43m 54s Intermediate
-
Introduction
-
1. iOS Keychain Services
-
Secure enclave41s
-
Attribute keys and values1m 44s
-
2. Storing Keychain Values
-
Xcode project configuration1m 31s
-
iOS code overview4m 12s
-
Storing a generic password2m 54s
-
Review keychain database2m 6s
-
-
3. Retrieving Data from the Keychain
-
Keychain search concepts4m 36s
-
Keychain search query1m 32s
-
Searching in keychain1m 40s
-
Handling search results3m 24s
-
-
4. Updating and Deleting Keychain Values
-
Update keychain preparation2m 34s
-
-
5. Keychain Sharing
-
Keychain access groups1m 39s
-
Sharing keychain data4m 18s
-
App group data sharing1m 20s
-
Sharing data in app group2m 42s
-
-
6. Building the App Challenges
-
Conclusion
-
Next steps32s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Handling search results