Skip to content

Latest commit

 

History

History
59 lines (50 loc) · 1.31 KB

change-app-icon.md

File metadata and controls

59 lines (50 loc) · 1.31 KB

Change app icon

  1. Update plist file
<key>CFBundleIcons</key>
	<dict>
		<key>CFBundleAlternateIcons</key>
		<dict>
			<key>Yalla</key>
			<dict>
				<key>CFBundleIconFiles</key>
				<array>
					<string>Yalla</string>
				</array>
			</dict>
			<key>Yo</key>
			<dict>
				<key>CFBundleIconFiles</key>
				<array>
					<string>Yo</string>
				</array>
			</dict>
		</dict>
		<key>CFBundlePrimaryIcon</key>
		<dict>
			<key>CFBundleIconFiles</key>
			<array>
				<string></string>
			</array>
			<key>UIPrerenderedIcon</key>
			<false/>
		</dict>
	</dict>
  1. Set alternate icon
guard let name = name else {
            // Reset to default
            UIApplication.shared.setAlternateIconName(nil)
            return
        }
        
        UIApplication.shared.setAlternateIconName(name){ error in
            if let error = error {
                print(error.localizedDescription)
            }
        }
  1. You cannot change the app icon in background. An alert message shows when the icon is changed.

Reference

supportsAlternateIcons

Change your app’s icon programmatically in iOS 10.3