Previous Lecture Complete and continue  

  Lecture 13. Authentication with Firebase - Sign Up New Users part 3

Ask for users for permission when accessing photo library.

Hey guys, since iOS 10, Apple requires us to declare ahead that we want to access user private data. We can ask for permission accessing the photo library by adding Privacy - Photo Library Usage Description to the Info.plist file.

Homework to Make Sense of The Lecture and Dig Deeper

Exercise 1.

Why don't UI Image Views response to user interaction whereas UI Buttons do? Hint: they might have a property indicating that, something related to "interaction".

Exercise 2.

In the lecture, we get the location of a profile photo on the database corresponding to a user by using: "gs://")

Can this be written more compactly?

Exercise 3.

In the lecture, we use the following snippet to create new user reference on the database:

let ref = FIRDatabase.database().reference()
let usersReference = ref.child("users")
let newUserReference = usersReference.child(uid!)

Use chaining to make the above snippet as compact as possible.

Exercise 4.

Given a FIRDatabaseReference object, a newUserReference object as in the lecture for example, whose string format is of the form root_refererence_string/users/user_relative_path_string, how do we extract the last token of this reference in string format, which is the user_relative_path_string?

Exercise 5.

Print and compare the following:

1. newUserReference.
2. newUserReference.description().
3. newUserReference.key.