如何在后台运行应用程序时更改应用程序图标

时间:2019-07-12 15:36:39

标签: ios background background-fetch

所以我按照本教程https://www.ioscreator.com/tutorials/background-fetch-ios-tutorial进行了背景抓取,效果很好,但是我尝试更改应用程序图标,而代码根本没有被调用。

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    //1
    if let viewController = window?.rootViewController as? ViewController {
        viewController.updateTime()//gets called and preformed perfectly in background
        UIApplication.shared.setAlternateIconName("blue", completionHandler: nil)//doesn't get called at all but as a button press function in ViewController it worked with me perfectly
    }
}

0 个答案:

没有答案
相关问题