iOS Background Mode

后端 未结 3 2050
梦毁少年i
梦毁少年i 2021-01-05 10:22

I have a question about running an app in the background. I know about how to do it, but Apple does not like the way I\'m doing it.

To get you on the same page, I ha

3条回答
  •  暖寄归人
    2021-01-05 11:02

    Being responsive is a need for every app. Users want to have apps which have their content ready when they open it, so developers should use Background Modes to make their apps more user friendly.

    Turning on the Background Modes capability

    1. Go to Xcode and open your project.
    2. In your app target, navigate to Capabilities tab.
    3. Turn on Background Modes.

    Background Fetch

    Background fetch is a new mode that lets your app appear always up-to-date with the latest information while minimizing the impact on battery. You could download feeds within fixed time intervals with this capability.

    To get started:

    1- Check Background Fetch in capabilities screen in Xcode.

    2- In application(_:didFinishLaunchingWithOptions:) method in AppDelegate,

    Reference: https://medium.com/@javedmultani16/background-modes-in-ios-3da25b9e6474

提交回复
热议问题