无法在iOS 11中设置备用应用程序图标

vik*_*lla 5 xcode ios swift xcode9-beta

我无法将应用程序的图标更改为iOS 11中的备用图标(Xcode 9,beta 3).

但是,它在iOS 10.3中运行良好(使用以下代码):

    if #available(iOS 10.3, *) {
        guard let iconName = MySingletonClass.sharedInstance.iconName() else { return }
        delay(0.01) {
            UIApplication.shared.setAlternateIconName(iconName, completionHandler: { (error) in
                if let error = error {
                    print(error.localizedDescription)
                } else {
                    print("Success!")
                }
            })
        }
    } else {
        // Fallback on earlier versions
    }
Run Code Online (Sandbox Code Playgroud)

我的plist设置如下:

在此输入图像描述

我发现它很奇怪,因为我在iOS 11中使用了其他使用备用应用程序图标的应用程序.在iOS 11中是否存在已知错误?

注意:如果您想知道我为什么要使用延迟,请参阅此帖子

vik*_*lla 2

我通过在 ViewController 中实现它来解决这个问题,而不是在 AppDelegate 的 appDidFinishLaunchingWithOptions 中实现

正如相关问题/答案所指出的那样,仍然需要在延迟内运行它才能正常工作。