Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to set alternate app icons in iOS 11

I am unable to change the app's icon to an alternate icon in iOS 11 (Xcode 9, beta 3).

However, it works fine in iOS 10.3 (with the following code):

    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
    }

My plist is set-up like so:

enter image description here

I find it odd because I have used other apps that use alternate app icons in iOS 11. Is there a known bug with this in iOS 11?

Note: If you're wondering why I'm using the delay, see this post

like image 640
vikzilla Avatar asked Oct 29 '22 05:10

vikzilla


1 Answers

I solved this by implementing it in a ViewController, rather than the AppDelegate's appDidFinishLaunchingWithOptions

Still need to run it within a delay for it to work though, as related questions / answers point out.

like image 114
vikzilla Avatar answered Nov 15 '22 05:11

vikzilla