开发者

How do I finish tasks in the background when the tasks is not in AppDelegate?

开发者 https://www.devze.com 2023-03-15 15:53 出处:网络
I have an app with the following hierrachy: - Tab bar controller: - Table view controller -> Some buttons

I have an app with the following hierrachy:

- Tab bar controller:
    - Table view controller -> Some buttons
    - Table view controller -> Some buttons

When pressing the buttons, the user may have to wait between 1-10 seconds (depending on internet connection). Until the task is completed, the user may exit the app, and when they return they should be able to see the downloaded content.

I realise that I have to implement applicationDidEnterBackground() . I've read the guide, however what I don't understand is that since the data is in another view controller, how do I pass it to the app delegate? The app delegate does not have all the data that it needs to 开发者_运维百科complete the computation. Furthermore, if I'm about halfway through, how do I pass it to the app delegate (without losing the work I've finished)?


Register for UIApplicationDidEnterBackgroundNotification and start the task in the VC?

0

精彩评论

暂无评论...
验证码 换一张
取 消