iosflutterinfo.plistappiconcfbundleicons

Flutter - Can not change app icon programmatically using CFBundleAlternateIcons


I've been trying to change my app icon using CFBundleAlternateIcons, but nothing happens.

I'm actually using a plugin for the Flutter SDK - flutter_dynamic_icon, when I change the icon using the plugin, it show a popup says 'You have changed the icon for MyApp' but nothing changes.

My question seems to be a repeat of this question: [https://stackoverflow.com/questions/64426880/xcode-ios-cfbundlealternateicons-not-changing] which already has an answer but it doesn't work for me.

I'm also trying to do the same as this article on medium: [https://medium.com/flutter-community/programatically-change-ios-app-icon-in-flutter-c9e84bc541a2] and the result is the same as when I used flutter_dynamic_icon.

Here is my info.plist:

<key>CFBundleIcons</key>
    <dict>
        <key>CFBundleAlternateIcons</key>
        <dict>
            <key>teamfortress</key>
            <dict>
                <key>UIPrerenderedIcon</key>
                <false/>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>teamfortress</string>
                </array>
            </dict>
            <key>chills</key>
            <dict>
                <key>UIPrerenderedIcon</key>
                <false/>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>chills</string>
                </array>
            </dict>
            <key>photos</key>
            <dict>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>photos</string>
                </array>
            </dict>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
    </dict>

I think something is wrong with my info.plist.

Has anyone experienced this problem?. Please help me, thanks a lot.


Solution

  • I've figured out the answer recently, for some reasons, my app can only be able to change app icon dynamically when I add icon images directly in Runner folder in Xcode and run flutter project from it. Hope it's helpful for you if you're encountering with above problem.