Info

In iOS 10.3, the function to change app icons has been added, which allows you to change the icon without updating the app.
AlternateAppIcon.gif

How to add

In Project

// Info.plist
...
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>icon_type_1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon1</string> // <- added the alternate icon name
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>icon_type_2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon2</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>icon_type_3</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon3</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string> // <- Assets AppIcon
</array>
</dict>
</dict>
...

In Code

  • Setting the alertnate Icon
if ([[UIApplication sharedApplication] supportsAlternateIcons] == NO)
return;
[[UIApplication sharedApplication] setAlternateIconName:@"icon_type_1" //AlternateIcons key name
completionHandler:^(NSError * _Nullable error) {
NSLog(@"%@", [error description]);
}];
  • Reset to the primary icon
if ([[UIApplication sharedApplication] supportsAlternateIcons] == NO)
return;
[[UIApplication sharedApplication] setAlternateIconName:nil
completionHandler:^(NSError * _Nullable error) {
NSLog(@"%@", [error description]);
}];


반응형