O'Reilly logo

Mastering iOS 11 Programming - Second Edition by Donny Wals

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating the movies

The process of updating movies is a strange process. As we saw earlier, network requests are performed asynchronously, which means that you can't rely on the network request being finished by the time a function is finished executing. Because of this, a callback is used, which enables us to know when a request is done.

But what happens if we need to wait for multiple requests? How do we know that we have finished making all of the requests to update movies? Since the movie database doesn't allow us to fetch all of our movies at once, we'll need to make a bunch of requests. When all of these requests are complete, we'll need to invoke the background fetch completionHandler with the result of our operation.

To achieve this, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required