1

This question is regarding the iOS 10.3’s new feature of giving user the ability to customize the app logo they see on the homescreen. (Check out MLB at Bat app for reference where they let the user pick which icon will be app logo: http://m.mlb.com/apps/atbat)

According to my research, we need to submit for apple review all the possible logo options. Then user can customize the logo using any of these options. Now in my specific use case, I might not always want all the logo options to be available to all the users. I need help figuring out how to control which logos are shown to all users? eg. if we have 10 images, for user A we may want to only show Image 1 and 2 to pick from; and for user B we may want to show only Image 3 and Image 4 to pick from as their app logo. Is this possible? Thanks so much in advance!

shallowThought
  • 19,212
  • 9
  • 65
  • 112
Ney
  • 11
  • 2
  • https://developer.apple.com/reference/uikit/uiapplication/2806818-setalternateiconname ? I guess that you call yourself that method, then you choose yourself what logo you want to show the user to chose from? – Larme May 04 '17 at 18:02

2 Answers2

0

You can control which icon is set using the setAlternateIconName(_:completionHandler:) method on UIApplication.

Example usage:

UIApplication.shared.setAlternateIconName("myImage", completionHandler: { error in
    print("completed")
})

You get to call this whenever it is appropriate in your application. So if you only want to only show a few options, you can do so with your own views, and only call this method when needed.

More information in the documentation here: https://developer.apple.com/reference/uikit/uiapplication/2806818-setalternateiconname

Here is another SO answer with helpful code and images: https://stackoverflow.com/a/41951096/6658553

Community
  • 1
  • 1
nathangitter
  • 9,607
  • 3
  • 33
  • 42
0

Add all icons to some folder in your application, with the help of below method you should manage which user should see which icons.

if([user isEqualToString:@"user1"]){
    [UIApplication.sharedApplication setAlternateIconName:@"icon1" completionHandler:^(NSError * _Nullable error) {
            if (error) {
                NSLog(@"---> error - %@",error.description);
            }
            else{
                NSLog(@"---> icon1 ");
            }
        }]
}

If you want to give user an option to choose from the icons, then also you can write the code accordingly so then he/she can only choose from the filtered ones.

niku
  • 472
  • 3
  • 12