5

Is it possible to change an iOS app's icon in runtime without the (“You have changed the icon for ‘AppName’") modal alert appearing, as per the discussion here:

https://loiter.com/blog/2018/03/08/changing-ios-app-icons-programmatically/

Also it seems that you can't change the icon from a (UIBackgroundTask) background task... Is that true?

Peter
  • 1,061
  • 1
  • 13
  • 20

1 Answers1

3

NOTE: This answer is old, It may not work on current iOS versions. Though it was working on iOS 10.3.

Yes, you can change app icon without Alert. Try below code:

if UIApplication.shared.supportsAlternateIcons {     
    UIApplication.shared.setAlternateIconName(appIcon)

    let tempVC = UIViewController()

    self.present(tempVC, animated: false, completion: {
        tempVC.dismiss(animated: false, completion: nil)
    })
}

iVarun
  • 6,496
  • 2
  • 26
  • 34
  • Ok thanks. But I strongly suspect that that is a hack that Apple would reject upon submission to the AppStore? – Peter Mar 11 '18 at 13:32
  • They might but this is the only way. :) – iVarun Mar 11 '18 at 14:17
  • Doesn't work on iOS 11.3.1. Use this instead https://stackoverflow.com/a/49730130/4894980 (still if you don't mind using private API) – AnthoPak Oct 02 '18 at 15:10