Is it allowed to let the alternate app icon to be dynamic?
Asked Answered
S

1

3

Since iOS 10.3 has been released, Apple added a new feature which allows us to change the app icon dynamically, by using setAlternateIconName(_:completionHandler:) method. So far, as mentioned in the method documentation, we have to mention the name(s) of the alternate app icon(s) in the project .plist file, assigned to CFBundlePrimaryIcon key.

Actually, when working with static icons (icons that have been added directly to the app main bundle) it works as expected without any problems:

enter image description here

My question is:

Is it possible -or is there a workaround- to set the alternate app icon dynamically (for instance: icons that have been downloaded from the web and saved in the app documents directory)?

Suckling answered 10/9, 2017 at 10:33 Comment(0)
C
3

I don't think its possible.

setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox.

Also, most probably Apple reviews the app icons you have bundled for avoiding use of same app icons or icons similar to Apple apps.

Refer: https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname

Celebes answered 10/9, 2017 at 12:40 Comment(6)
Thank you for the answer. "setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox", could you please add a reference for it?Suckling
@AhmadF: I have included a link to a blog from hackingswift. I am looking inside Apple doc as well. I will include that in my answer as well. I am pretty sure it cant be done though.Celebes
I was thinking about it, even as a workaround it might won't work... at some point, you have to mention the icon names in the project plist, which probably couldn't be done at runtime. I would be great if you could find a reference from apple that mentioning this...Suckling
@AhmadF: Even if you can provide the names at the runtime, you would need to bundle the icons with the app. I hope apple revisits this in future but currently its not possible.Celebes
If you would add a reference for something official, I will be glad to accept it :)Suckling
@AhmadF, i'v been looking for a workaround on this as well, what i have in my mind, make the file icon file names static like (icon1, icon2) , and override the icon on runtime, or remove the previous one and set new one, but since all i could do was download into the documentDirectory, it's been a failure : ) do you have a solution or workaround for it now ?Gustatory

© 2022 - 2024 — McMap. All rights reserved.