Dmitriy Ivashin
Dmitriy Ivashin

Reputation: 27

Dynamic App Icons iOS

Is there any way to customize "You have changed the icon for AppName" message after UIApplication.shared.setAlternateIconName("image") call or get rid of it at all?

Upvotes: 1

Views: 2162

Answers (2)

Dmitriy Ivashin
Dmitriy Ivashin

Reputation: 27

Well, there's a solution to customize the text, but not sure whether Apple would approve it. We need to get the label:

func findTheLabel(in view: UIView)
{
    for item in view.subviews {
        if let view = item as? UILabel, view.text == "You have changed the icon for “myApp”." {
            view.text = "Hi, \n kind greetings from “myApp”."
            view.textAlignment = .justified
        }
        guard item.subviews.count > 0 else { continue }
        findTheLabel(in: item)
    }
}

And simply call it right after:

UIApplication.shared.setAlternateIconName(iconName) { (error) in print(error) }

with small dispatch

            Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false) {_ in
                if let view = UIApplication.topViewController()?.view {
                    self.findTheLabel(in: view)
                }
            }

Maybe someone would find it useful.

Upvotes: 0

user9749232
user9749232

Reputation:

Sadly you can't because it is provided by the system, according to Apple's official guidelines.

Note that your app icon can only be changed at the user’s request and the system always provides the user with confirmation of such a change.

https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/

Upvotes: 3

Related Questions