Changing alternate icon for iPad












7















I have a problem with changing app's icon on iPad. Everything is working fine on iPhone but on iPad I get this error :




[default] Failed to set preferredIconName to AI-Gorgosaurus for
...:0> error: Error
Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
UserInfo={NSUnderlyingError=0x600000248a30 {Error
Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found
in CFBundleAlternateIcons entry"
UserInfo={NSLocalizedDescription=iconName not found in
CFBundleAlternateIcons entry}}} App icon failed to due to The file
doesn’t exist.




I searched ad found that I need to add ~ipad in CFBundleIconFiles but still get the same error!.



Here is the code:



  func changeIcon(to name: String?) {
//Check if the app supports alternating icons
guard UIApplication.shared.supportsAlternateIcons else {
return;
}

//Change the icon to a specific image with given name
UIApplication.shared.setAlternateIconName(name) { (error) in
//After app icon changed, print our error or success message
if let error = error {
print("App icon failed to due to (error.localizedDescription)")
} else {
print("App icon changed successfully.")
}
}
}


enter image description here



I just tested on another project and works fine !!! but not on my current project why ?! have you any idea?










share|improve this question





























    7















    I have a problem with changing app's icon on iPad. Everything is working fine on iPhone but on iPad I get this error :




    [default] Failed to set preferredIconName to AI-Gorgosaurus for
    ...:0> error: Error
    Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
    UserInfo={NSUnderlyingError=0x600000248a30 {Error
    Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found
    in CFBundleAlternateIcons entry"
    UserInfo={NSLocalizedDescription=iconName not found in
    CFBundleAlternateIcons entry}}} App icon failed to due to The file
    doesn’t exist.




    I searched ad found that I need to add ~ipad in CFBundleIconFiles but still get the same error!.



    Here is the code:



      func changeIcon(to name: String?) {
    //Check if the app supports alternating icons
    guard UIApplication.shared.supportsAlternateIcons else {
    return;
    }

    //Change the icon to a specific image with given name
    UIApplication.shared.setAlternateIconName(name) { (error) in
    //After app icon changed, print our error or success message
    if let error = error {
    print("App icon failed to due to (error.localizedDescription)")
    } else {
    print("App icon changed successfully.")
    }
    }
    }


    enter image description here



    I just tested on another project and works fine !!! but not on my current project why ?! have you any idea?










    share|improve this question



























      7












      7








      7


      1






      I have a problem with changing app's icon on iPad. Everything is working fine on iPhone but on iPad I get this error :




      [default] Failed to set preferredIconName to AI-Gorgosaurus for
      ...:0> error: Error
      Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
      UserInfo={NSUnderlyingError=0x600000248a30 {Error
      Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found
      in CFBundleAlternateIcons entry"
      UserInfo={NSLocalizedDescription=iconName not found in
      CFBundleAlternateIcons entry}}} App icon failed to due to The file
      doesn’t exist.




      I searched ad found that I need to add ~ipad in CFBundleIconFiles but still get the same error!.



      Here is the code:



        func changeIcon(to name: String?) {
      //Check if the app supports alternating icons
      guard UIApplication.shared.supportsAlternateIcons else {
      return;
      }

      //Change the icon to a specific image with given name
      UIApplication.shared.setAlternateIconName(name) { (error) in
      //After app icon changed, print our error or success message
      if let error = error {
      print("App icon failed to due to (error.localizedDescription)")
      } else {
      print("App icon changed successfully.")
      }
      }
      }


      enter image description here



      I just tested on another project and works fine !!! but not on my current project why ?! have you any idea?










      share|improve this question
















      I have a problem with changing app's icon on iPad. Everything is working fine on iPhone but on iPad I get this error :




      [default] Failed to set preferredIconName to AI-Gorgosaurus for
      ...:0> error: Error
      Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
      UserInfo={NSUnderlyingError=0x600000248a30 {Error
      Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found
      in CFBundleAlternateIcons entry"
      UserInfo={NSLocalizedDescription=iconName not found in
      CFBundleAlternateIcons entry}}} App icon failed to due to The file
      doesn’t exist.




      I searched ad found that I need to add ~ipad in CFBundleIconFiles but still get the same error!.



      Here is the code:



        func changeIcon(to name: String?) {
      //Check if the app supports alternating icons
      guard UIApplication.shared.supportsAlternateIcons else {
      return;
      }

      //Change the icon to a specific image with given name
      UIApplication.shared.setAlternateIconName(name) { (error) in
      //After app icon changed, print our error or success message
      if let error = error {
      print("App icon failed to due to (error.localizedDescription)")
      } else {
      print("App icon changed successfully.")
      }
      }
      }


      enter image description here



      I just tested on another project and works fine !!! but not on my current project why ?! have you any idea?







      ios iphone swift xcode ipad






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 27 '18 at 19:04







      Mc.Lover

















      asked Aug 21 '18 at 13:08









      Mc.LoverMc.Lover

      1,1791871135




      1,1791871135
























          5 Answers
          5






          active

          oldest

          votes


















          2














          Your info.plist is structured incorrectly.



          You have:



          - CFBundleIcons
          - CFBundleAlternateIcons
          - Icon Name
          - CFBundleFilesIcons
          - CFBundleFilesIcons~ipad


          But it should be:



          - CFBundleIcons
          - CFBundleAlternateIcons
          - Icon Name
          - CFBundleFilesIcons
          - CFBundleIcons~ipad
          - CFBundleAlternateIcons
          - Icon Name
          - CFBundleFilesIcons


          Basically, once you have it working with iPhone icons, CFBundleIcons, duplicate the entire tree as CFBundleIcons~ipad. The iPad files shouldn't be nested under CFBundleIcons at all.



          You're mixing up CFBundleIcons~ipad and CFBundleIconFiles~ipad (which isn't a valid key).



          Screenshot






          share|improve this answer





















          • 1





            Thank you so much! finally it works.

            – Mc.Lover
            Nov 28 '18 at 12:49











          • @Mc.Lover You're welcome!

            – Dave Wood
            Nov 28 '18 at 16:33



















          1














          What I have noticed is that your plist has
          UIPrerenderedIcon set to NO



          Change it to YES



          It might be that the issue is with the rendering



          Edit 1: add the .png extension to see if it helps



          EDIT 2: Try changing the new icon's filename to ipadAlternate.png. Then change to the same name in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself



          EDIT 3: Have you cleaned the DerivedData folder? I had an issue a while ago and nothing helped including cleaning the project etc. But I tried deleting everything in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData/ folder and it started working again. It is worth giving it a go.



          EDIT 4: Try doing step from EDIT 3. Then restart your project and delete all the alternative icon files from it. Choose move to trash and then CMD+SHIFT+K to clean. Then select CMD+B to build. Next add the icons back where they were. Check that the target is selected correctly and copy items if needed to be selected. For some reason Xcode lost track of your file and it is showing an error, no file.



          If that will not help then try the above steps. But first try moving the whole project to a different folder.



          EDIT 5: There is one more idea which you might try for yourself. Try deleting the plist file in the current project (keep a backup copy of it before deleting) then start a new project where the icon changing works fine. Add the plist from that project to this one. Check if the icon changing works. If yes then add all the missing keys you had in the previous project.



          WARNING: This is a last resort but this may work. Start a new project and set it up with the icons which you want alternating. Check if they work first then add all the code and dependencies from the project where it doesn't work. Just don't override the PLIST files.



          EDIT 6: Try deleting the app from the simulator or the device you are trying it on and reinstall it. The whole issue might be with the update and the leftovers from the previous version of the app.



          EDIT 7: Try copying the project to another mac and see if the problem persists. Which xcode version are you using?? If it is Xcode 9, perhaps try using the Xcode 10 beta.






          share|improve this answer


























          • I changed it to YES still not working!

            – Mc.Lover
            Aug 25 '18 at 8:28











          • Add the .png extension see if it helps

            – AD Progress
            Aug 25 '18 at 8:36











          • I tried everything, there is no logical reason :|

            – Mc.Lover
            Aug 25 '18 at 8:36











          • Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

            – AD Progress
            Aug 25 '18 at 8:41











          • Could you share your code on github or somewhere so I could either fork it or contribute??

            – AD Progress
            Aug 25 '18 at 14:00



















          1














          Please make these changes to your plist file for setting alternate icons for iPhone and iPad.



          enter image description here






          share|improve this answer































            0














            With below structure i'm able to change icon in iPad:



                if #available(iOS 10.3, *) {
            let newAppIconName = "Icon2"

            guard UIApplication.shared.alternateIconName != newAppIconName else { return }

            UIApplication.shared.setAlternateIconName(newAppIconName)
            }
            }


            Plist Code:



            <key>CFBundleIcons</key>
            <dict>
            <key>CFBundlePrimaryIcon</key>
            <dict>
            <key>CFBundleIconFiles</key>
            <array>
            <string>AppIcon</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <true/>
            </dict>
            <key>CFBundleAlternateIcons</key>
            <dict>
            <key>Icon2</key>
            <dict>
            <key>CFBundleIconFiles</key>
            <array>
            <string>icon60</string>
            </array>
            <key>CFBundleIcons~ipad</key>
            <array>
            <string>iTunesArtwork80.png</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <true/>
            </dict>
            </dict>
            </dict>


            enter image description here






            share|improve this answer
























            • Thank you but I am doing exactly like this but what I get is the error!

              – Mc.Lover
              Aug 21 '18 at 13:56











            • CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

              – Mc.Lover
              Aug 21 '18 at 13:57






            • 1





              You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

              – iVarun
              Aug 21 '18 at 13:59











            • Could you please try to change your code with my code. Coz it is working for me.

              – iVarun
              Aug 21 '18 at 14:02






            • 1





              Actually i left the office but can surely help tomorrow.

              – iVarun
              Aug 21 '18 at 14:13



















            0














            The error is showing a different file name than the one in .plist CFBundleAlternateIcons. Make sure you assign a correct Filename in and it actually exists in the project folder.



            Error Shows AI-Gorgosaurus as the file name. .plist screenshot shows AI-Diabloceratops~ipad, also please remove ~ symbol from the file name.



            Do a clean and build the project after you're sure file is correct. Make sure you have @2x and @3x version of your Icons in your project folder.



            Read Kaiyuan Xu answer for a more clear picture on how to use CFBundleAlternateIcons.






            share|improve this answer


























            • The image is old, I checked everything.

              – Mc.Lover
              Aug 29 '18 at 7:45











            • Ok, let’s do screen sharing, I need to get a more clear view of the problem.

              – Farhad
              Aug 29 '18 at 11:02











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51949430%2fchanging-alternate-icon-for-ipad%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Your info.plist is structured incorrectly.



            You have:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleFilesIcons~ipad


            But it should be:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleIcons~ipad
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons


            Basically, once you have it working with iPhone icons, CFBundleIcons, duplicate the entire tree as CFBundleIcons~ipad. The iPad files shouldn't be nested under CFBundleIcons at all.



            You're mixing up CFBundleIcons~ipad and CFBundleIconFiles~ipad (which isn't a valid key).



            Screenshot






            share|improve this answer





















            • 1





              Thank you so much! finally it works.

              – Mc.Lover
              Nov 28 '18 at 12:49











            • @Mc.Lover You're welcome!

              – Dave Wood
              Nov 28 '18 at 16:33
















            2














            Your info.plist is structured incorrectly.



            You have:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleFilesIcons~ipad


            But it should be:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleIcons~ipad
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons


            Basically, once you have it working with iPhone icons, CFBundleIcons, duplicate the entire tree as CFBundleIcons~ipad. The iPad files shouldn't be nested under CFBundleIcons at all.



            You're mixing up CFBundleIcons~ipad and CFBundleIconFiles~ipad (which isn't a valid key).



            Screenshot






            share|improve this answer





















            • 1





              Thank you so much! finally it works.

              – Mc.Lover
              Nov 28 '18 at 12:49











            • @Mc.Lover You're welcome!

              – Dave Wood
              Nov 28 '18 at 16:33














            2












            2








            2







            Your info.plist is structured incorrectly.



            You have:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleFilesIcons~ipad


            But it should be:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleIcons~ipad
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons


            Basically, once you have it working with iPhone icons, CFBundleIcons, duplicate the entire tree as CFBundleIcons~ipad. The iPad files shouldn't be nested under CFBundleIcons at all.



            You're mixing up CFBundleIcons~ipad and CFBundleIconFiles~ipad (which isn't a valid key).



            Screenshot






            share|improve this answer















            Your info.plist is structured incorrectly.



            You have:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleFilesIcons~ipad


            But it should be:



            - CFBundleIcons
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons
            - CFBundleIcons~ipad
            - CFBundleAlternateIcons
            - Icon Name
            - CFBundleFilesIcons


            Basically, once you have it working with iPhone icons, CFBundleIcons, duplicate the entire tree as CFBundleIcons~ipad. The iPad files shouldn't be nested under CFBundleIcons at all.



            You're mixing up CFBundleIcons~ipad and CFBundleIconFiles~ipad (which isn't a valid key).



            Screenshot







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 27 '18 at 6:42

























            answered Nov 27 '18 at 6:36









            Dave WoodDave Wood

            10.2k13953




            10.2k13953








            • 1





              Thank you so much! finally it works.

              – Mc.Lover
              Nov 28 '18 at 12:49











            • @Mc.Lover You're welcome!

              – Dave Wood
              Nov 28 '18 at 16:33














            • 1





              Thank you so much! finally it works.

              – Mc.Lover
              Nov 28 '18 at 12:49











            • @Mc.Lover You're welcome!

              – Dave Wood
              Nov 28 '18 at 16:33








            1




            1





            Thank you so much! finally it works.

            – Mc.Lover
            Nov 28 '18 at 12:49





            Thank you so much! finally it works.

            – Mc.Lover
            Nov 28 '18 at 12:49













            @Mc.Lover You're welcome!

            – Dave Wood
            Nov 28 '18 at 16:33





            @Mc.Lover You're welcome!

            – Dave Wood
            Nov 28 '18 at 16:33













            1














            What I have noticed is that your plist has
            UIPrerenderedIcon set to NO



            Change it to YES



            It might be that the issue is with the rendering



            Edit 1: add the .png extension to see if it helps



            EDIT 2: Try changing the new icon's filename to ipadAlternate.png. Then change to the same name in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself



            EDIT 3: Have you cleaned the DerivedData folder? I had an issue a while ago and nothing helped including cleaning the project etc. But I tried deleting everything in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData/ folder and it started working again. It is worth giving it a go.



            EDIT 4: Try doing step from EDIT 3. Then restart your project and delete all the alternative icon files from it. Choose move to trash and then CMD+SHIFT+K to clean. Then select CMD+B to build. Next add the icons back where they were. Check that the target is selected correctly and copy items if needed to be selected. For some reason Xcode lost track of your file and it is showing an error, no file.



            If that will not help then try the above steps. But first try moving the whole project to a different folder.



            EDIT 5: There is one more idea which you might try for yourself. Try deleting the plist file in the current project (keep a backup copy of it before deleting) then start a new project where the icon changing works fine. Add the plist from that project to this one. Check if the icon changing works. If yes then add all the missing keys you had in the previous project.



            WARNING: This is a last resort but this may work. Start a new project and set it up with the icons which you want alternating. Check if they work first then add all the code and dependencies from the project where it doesn't work. Just don't override the PLIST files.



            EDIT 6: Try deleting the app from the simulator or the device you are trying it on and reinstall it. The whole issue might be with the update and the leftovers from the previous version of the app.



            EDIT 7: Try copying the project to another mac and see if the problem persists. Which xcode version are you using?? If it is Xcode 9, perhaps try using the Xcode 10 beta.






            share|improve this answer


























            • I changed it to YES still not working!

              – Mc.Lover
              Aug 25 '18 at 8:28











            • Add the .png extension see if it helps

              – AD Progress
              Aug 25 '18 at 8:36











            • I tried everything, there is no logical reason :|

              – Mc.Lover
              Aug 25 '18 at 8:36











            • Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

              – AD Progress
              Aug 25 '18 at 8:41











            • Could you share your code on github or somewhere so I could either fork it or contribute??

              – AD Progress
              Aug 25 '18 at 14:00
















            1














            What I have noticed is that your plist has
            UIPrerenderedIcon set to NO



            Change it to YES



            It might be that the issue is with the rendering



            Edit 1: add the .png extension to see if it helps



            EDIT 2: Try changing the new icon's filename to ipadAlternate.png. Then change to the same name in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself



            EDIT 3: Have you cleaned the DerivedData folder? I had an issue a while ago and nothing helped including cleaning the project etc. But I tried deleting everything in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData/ folder and it started working again. It is worth giving it a go.



            EDIT 4: Try doing step from EDIT 3. Then restart your project and delete all the alternative icon files from it. Choose move to trash and then CMD+SHIFT+K to clean. Then select CMD+B to build. Next add the icons back where they were. Check that the target is selected correctly and copy items if needed to be selected. For some reason Xcode lost track of your file and it is showing an error, no file.



            If that will not help then try the above steps. But first try moving the whole project to a different folder.



            EDIT 5: There is one more idea which you might try for yourself. Try deleting the plist file in the current project (keep a backup copy of it before deleting) then start a new project where the icon changing works fine. Add the plist from that project to this one. Check if the icon changing works. If yes then add all the missing keys you had in the previous project.



            WARNING: This is a last resort but this may work. Start a new project and set it up with the icons which you want alternating. Check if they work first then add all the code and dependencies from the project where it doesn't work. Just don't override the PLIST files.



            EDIT 6: Try deleting the app from the simulator or the device you are trying it on and reinstall it. The whole issue might be with the update and the leftovers from the previous version of the app.



            EDIT 7: Try copying the project to another mac and see if the problem persists. Which xcode version are you using?? If it is Xcode 9, perhaps try using the Xcode 10 beta.






            share|improve this answer


























            • I changed it to YES still not working!

              – Mc.Lover
              Aug 25 '18 at 8:28











            • Add the .png extension see if it helps

              – AD Progress
              Aug 25 '18 at 8:36











            • I tried everything, there is no logical reason :|

              – Mc.Lover
              Aug 25 '18 at 8:36











            • Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

              – AD Progress
              Aug 25 '18 at 8:41











            • Could you share your code on github or somewhere so I could either fork it or contribute??

              – AD Progress
              Aug 25 '18 at 14:00














            1












            1








            1







            What I have noticed is that your plist has
            UIPrerenderedIcon set to NO



            Change it to YES



            It might be that the issue is with the rendering



            Edit 1: add the .png extension to see if it helps



            EDIT 2: Try changing the new icon's filename to ipadAlternate.png. Then change to the same name in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself



            EDIT 3: Have you cleaned the DerivedData folder? I had an issue a while ago and nothing helped including cleaning the project etc. But I tried deleting everything in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData/ folder and it started working again. It is worth giving it a go.



            EDIT 4: Try doing step from EDIT 3. Then restart your project and delete all the alternative icon files from it. Choose move to trash and then CMD+SHIFT+K to clean. Then select CMD+B to build. Next add the icons back where they were. Check that the target is selected correctly and copy items if needed to be selected. For some reason Xcode lost track of your file and it is showing an error, no file.



            If that will not help then try the above steps. But first try moving the whole project to a different folder.



            EDIT 5: There is one more idea which you might try for yourself. Try deleting the plist file in the current project (keep a backup copy of it before deleting) then start a new project where the icon changing works fine. Add the plist from that project to this one. Check if the icon changing works. If yes then add all the missing keys you had in the previous project.



            WARNING: This is a last resort but this may work. Start a new project and set it up with the icons which you want alternating. Check if they work first then add all the code and dependencies from the project where it doesn't work. Just don't override the PLIST files.



            EDIT 6: Try deleting the app from the simulator or the device you are trying it on and reinstall it. The whole issue might be with the update and the leftovers from the previous version of the app.



            EDIT 7: Try copying the project to another mac and see if the problem persists. Which xcode version are you using?? If it is Xcode 9, perhaps try using the Xcode 10 beta.






            share|improve this answer















            What I have noticed is that your plist has
            UIPrerenderedIcon set to NO



            Change it to YES



            It might be that the issue is with the rendering



            Edit 1: add the .png extension to see if it helps



            EDIT 2: Try changing the new icon's filename to ipadAlternate.png. Then change to the same name in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself



            EDIT 3: Have you cleaned the DerivedData folder? I had an issue a while ago and nothing helped including cleaning the project etc. But I tried deleting everything in the /Users/YOURUSERNAME/Library/Developer/Xcode/DerivedData/ folder and it started working again. It is worth giving it a go.



            EDIT 4: Try doing step from EDIT 3. Then restart your project and delete all the alternative icon files from it. Choose move to trash and then CMD+SHIFT+K to clean. Then select CMD+B to build. Next add the icons back where they were. Check that the target is selected correctly and copy items if needed to be selected. For some reason Xcode lost track of your file and it is showing an error, no file.



            If that will not help then try the above steps. But first try moving the whole project to a different folder.



            EDIT 5: There is one more idea which you might try for yourself. Try deleting the plist file in the current project (keep a backup copy of it before deleting) then start a new project where the icon changing works fine. Add the plist from that project to this one. Check if the icon changing works. If yes then add all the missing keys you had in the previous project.



            WARNING: This is a last resort but this may work. Start a new project and set it up with the icons which you want alternating. Check if they work first then add all the code and dependencies from the project where it doesn't work. Just don't override the PLIST files.



            EDIT 6: Try deleting the app from the simulator or the device you are trying it on and reinstall it. The whole issue might be with the update and the leftovers from the previous version of the app.



            EDIT 7: Try copying the project to another mac and see if the problem persists. Which xcode version are you using?? If it is Xcode 9, perhaps try using the Xcode 10 beta.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 15 '18 at 6:08









            Marcy

            4462511




            4462511










            answered Aug 25 '18 at 8:24









            AD ProgressAD Progress

            733116




            733116













            • I changed it to YES still not working!

              – Mc.Lover
              Aug 25 '18 at 8:28











            • Add the .png extension see if it helps

              – AD Progress
              Aug 25 '18 at 8:36











            • I tried everything, there is no logical reason :|

              – Mc.Lover
              Aug 25 '18 at 8:36











            • Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

              – AD Progress
              Aug 25 '18 at 8:41











            • Could you share your code on github or somewhere so I could either fork it or contribute??

              – AD Progress
              Aug 25 '18 at 14:00



















            • I changed it to YES still not working!

              – Mc.Lover
              Aug 25 '18 at 8:28











            • Add the .png extension see if it helps

              – AD Progress
              Aug 25 '18 at 8:36











            • I tried everything, there is no logical reason :|

              – Mc.Lover
              Aug 25 '18 at 8:36











            • Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

              – AD Progress
              Aug 25 '18 at 8:41











            • Could you share your code on github or somewhere so I could either fork it or contribute??

              – AD Progress
              Aug 25 '18 at 14:00

















            I changed it to YES still not working!

            – Mc.Lover
            Aug 25 '18 at 8:28





            I changed it to YES still not working!

            – Mc.Lover
            Aug 25 '18 at 8:28













            Add the .png extension see if it helps

            – AD Progress
            Aug 25 '18 at 8:36





            Add the .png extension see if it helps

            – AD Progress
            Aug 25 '18 at 8:36













            I tried everything, there is no logical reason :|

            – Mc.Lover
            Aug 25 '18 at 8:36





            I tried everything, there is no logical reason :|

            – Mc.Lover
            Aug 25 '18 at 8:36













            Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

            – AD Progress
            Aug 25 '18 at 8:41





            Try changing the new icons filename to ipadAlternate.png and then change to the same in the plist as it looks like there is some kind of mismatch with your plist and the icon file itself

            – AD Progress
            Aug 25 '18 at 8:41













            Could you share your code on github or somewhere so I could either fork it or contribute??

            – AD Progress
            Aug 25 '18 at 14:00





            Could you share your code on github or somewhere so I could either fork it or contribute??

            – AD Progress
            Aug 25 '18 at 14:00











            1














            Please make these changes to your plist file for setting alternate icons for iPhone and iPad.



            enter image description here






            share|improve this answer




























              1














              Please make these changes to your plist file for setting alternate icons for iPhone and iPad.



              enter image description here






              share|improve this answer


























                1












                1








                1







                Please make these changes to your plist file for setting alternate icons for iPhone and iPad.



                enter image description here






                share|improve this answer













                Please make these changes to your plist file for setting alternate icons for iPhone and iPad.



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 6:23









                Rizwan ShaikhRizwan Shaikh

                1686




                1686























                    0














                    With below structure i'm able to change icon in iPad:



                        if #available(iOS 10.3, *) {
                    let newAppIconName = "Icon2"

                    guard UIApplication.shared.alternateIconName != newAppIconName else { return }

                    UIApplication.shared.setAlternateIconName(newAppIconName)
                    }
                    }


                    Plist Code:



                    <key>CFBundleIcons</key>
                    <dict>
                    <key>CFBundlePrimaryIcon</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>AppIcon</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    <key>CFBundleAlternateIcons</key>
                    <dict>
                    <key>Icon2</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>icon60</string>
                    </array>
                    <key>CFBundleIcons~ipad</key>
                    <array>
                    <string>iTunesArtwork80.png</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    </dict>
                    </dict>


                    enter image description here






                    share|improve this answer
























                    • Thank you but I am doing exactly like this but what I get is the error!

                      – Mc.Lover
                      Aug 21 '18 at 13:56











                    • CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                      – Mc.Lover
                      Aug 21 '18 at 13:57






                    • 1





                      You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                      – iVarun
                      Aug 21 '18 at 13:59











                    • Could you please try to change your code with my code. Coz it is working for me.

                      – iVarun
                      Aug 21 '18 at 14:02






                    • 1





                      Actually i left the office but can surely help tomorrow.

                      – iVarun
                      Aug 21 '18 at 14:13
















                    0














                    With below structure i'm able to change icon in iPad:



                        if #available(iOS 10.3, *) {
                    let newAppIconName = "Icon2"

                    guard UIApplication.shared.alternateIconName != newAppIconName else { return }

                    UIApplication.shared.setAlternateIconName(newAppIconName)
                    }
                    }


                    Plist Code:



                    <key>CFBundleIcons</key>
                    <dict>
                    <key>CFBundlePrimaryIcon</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>AppIcon</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    <key>CFBundleAlternateIcons</key>
                    <dict>
                    <key>Icon2</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>icon60</string>
                    </array>
                    <key>CFBundleIcons~ipad</key>
                    <array>
                    <string>iTunesArtwork80.png</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    </dict>
                    </dict>


                    enter image description here






                    share|improve this answer
























                    • Thank you but I am doing exactly like this but what I get is the error!

                      – Mc.Lover
                      Aug 21 '18 at 13:56











                    • CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                      – Mc.Lover
                      Aug 21 '18 at 13:57






                    • 1





                      You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                      – iVarun
                      Aug 21 '18 at 13:59











                    • Could you please try to change your code with my code. Coz it is working for me.

                      – iVarun
                      Aug 21 '18 at 14:02






                    • 1





                      Actually i left the office but can surely help tomorrow.

                      – iVarun
                      Aug 21 '18 at 14:13














                    0












                    0








                    0







                    With below structure i'm able to change icon in iPad:



                        if #available(iOS 10.3, *) {
                    let newAppIconName = "Icon2"

                    guard UIApplication.shared.alternateIconName != newAppIconName else { return }

                    UIApplication.shared.setAlternateIconName(newAppIconName)
                    }
                    }


                    Plist Code:



                    <key>CFBundleIcons</key>
                    <dict>
                    <key>CFBundlePrimaryIcon</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>AppIcon</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    <key>CFBundleAlternateIcons</key>
                    <dict>
                    <key>Icon2</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>icon60</string>
                    </array>
                    <key>CFBundleIcons~ipad</key>
                    <array>
                    <string>iTunesArtwork80.png</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    </dict>
                    </dict>


                    enter image description here






                    share|improve this answer













                    With below structure i'm able to change icon in iPad:



                        if #available(iOS 10.3, *) {
                    let newAppIconName = "Icon2"

                    guard UIApplication.shared.alternateIconName != newAppIconName else { return }

                    UIApplication.shared.setAlternateIconName(newAppIconName)
                    }
                    }


                    Plist Code:



                    <key>CFBundleIcons</key>
                    <dict>
                    <key>CFBundlePrimaryIcon</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>AppIcon</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    <key>CFBundleAlternateIcons</key>
                    <dict>
                    <key>Icon2</key>
                    <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                    <string>icon60</string>
                    </array>
                    <key>CFBundleIcons~ipad</key>
                    <array>
                    <string>iTunesArtwork80.png</string>
                    </array>
                    <key>UIPrerenderedIcon</key>
                    <true/>
                    </dict>
                    </dict>
                    </dict>


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 21 '18 at 13:52









                    iVaruniVarun

                    3,74421325




                    3,74421325













                    • Thank you but I am doing exactly like this but what I get is the error!

                      – Mc.Lover
                      Aug 21 '18 at 13:56











                    • CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                      – Mc.Lover
                      Aug 21 '18 at 13:57






                    • 1





                      You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                      – iVarun
                      Aug 21 '18 at 13:59











                    • Could you please try to change your code with my code. Coz it is working for me.

                      – iVarun
                      Aug 21 '18 at 14:02






                    • 1





                      Actually i left the office but can surely help tomorrow.

                      – iVarun
                      Aug 21 '18 at 14:13



















                    • Thank you but I am doing exactly like this but what I get is the error!

                      – Mc.Lover
                      Aug 21 '18 at 13:56











                    • CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                      – Mc.Lover
                      Aug 21 '18 at 13:57






                    • 1





                      You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                      – iVarun
                      Aug 21 '18 at 13:59











                    • Could you please try to change your code with my code. Coz it is working for me.

                      – iVarun
                      Aug 21 '18 at 14:02






                    • 1





                      Actually i left the office but can surely help tomorrow.

                      – iVarun
                      Aug 21 '18 at 14:13

















                    Thank you but I am doing exactly like this but what I get is the error!

                    – Mc.Lover
                    Aug 21 '18 at 13:56





                    Thank you but I am doing exactly like this but what I get is the error!

                    – Mc.Lover
                    Aug 21 '18 at 13:56













                    CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                    – Mc.Lover
                    Aug 21 '18 at 13:57





                    CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}} App icon failed to due to The file doesn’t exist.

                    – Mc.Lover
                    Aug 21 '18 at 13:57




                    1




                    1





                    You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                    – iVarun
                    Aug 21 '18 at 13:59





                    You can see i am using CFBundleIcons~ipad and you are CFBundleIconsFiles~ipad.

                    – iVarun
                    Aug 21 '18 at 13:59













                    Could you please try to change your code with my code. Coz it is working for me.

                    – iVarun
                    Aug 21 '18 at 14:02





                    Could you please try to change your code with my code. Coz it is working for me.

                    – iVarun
                    Aug 21 '18 at 14:02




                    1




                    1





                    Actually i left the office but can surely help tomorrow.

                    – iVarun
                    Aug 21 '18 at 14:13





                    Actually i left the office but can surely help tomorrow.

                    – iVarun
                    Aug 21 '18 at 14:13











                    0














                    The error is showing a different file name than the one in .plist CFBundleAlternateIcons. Make sure you assign a correct Filename in and it actually exists in the project folder.



                    Error Shows AI-Gorgosaurus as the file name. .plist screenshot shows AI-Diabloceratops~ipad, also please remove ~ symbol from the file name.



                    Do a clean and build the project after you're sure file is correct. Make sure you have @2x and @3x version of your Icons in your project folder.



                    Read Kaiyuan Xu answer for a more clear picture on how to use CFBundleAlternateIcons.






                    share|improve this answer


























                    • The image is old, I checked everything.

                      – Mc.Lover
                      Aug 29 '18 at 7:45











                    • Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                      – Farhad
                      Aug 29 '18 at 11:02
















                    0














                    The error is showing a different file name than the one in .plist CFBundleAlternateIcons. Make sure you assign a correct Filename in and it actually exists in the project folder.



                    Error Shows AI-Gorgosaurus as the file name. .plist screenshot shows AI-Diabloceratops~ipad, also please remove ~ symbol from the file name.



                    Do a clean and build the project after you're sure file is correct. Make sure you have @2x and @3x version of your Icons in your project folder.



                    Read Kaiyuan Xu answer for a more clear picture on how to use CFBundleAlternateIcons.






                    share|improve this answer


























                    • The image is old, I checked everything.

                      – Mc.Lover
                      Aug 29 '18 at 7:45











                    • Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                      – Farhad
                      Aug 29 '18 at 11:02














                    0












                    0








                    0







                    The error is showing a different file name than the one in .plist CFBundleAlternateIcons. Make sure you assign a correct Filename in and it actually exists in the project folder.



                    Error Shows AI-Gorgosaurus as the file name. .plist screenshot shows AI-Diabloceratops~ipad, also please remove ~ symbol from the file name.



                    Do a clean and build the project after you're sure file is correct. Make sure you have @2x and @3x version of your Icons in your project folder.



                    Read Kaiyuan Xu answer for a more clear picture on how to use CFBundleAlternateIcons.






                    share|improve this answer















                    The error is showing a different file name than the one in .plist CFBundleAlternateIcons. Make sure you assign a correct Filename in and it actually exists in the project folder.



                    Error Shows AI-Gorgosaurus as the file name. .plist screenshot shows AI-Diabloceratops~ipad, also please remove ~ symbol from the file name.



                    Do a clean and build the project after you're sure file is correct. Make sure you have @2x and @3x version of your Icons in your project folder.



                    Read Kaiyuan Xu answer for a more clear picture on how to use CFBundleAlternateIcons.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 28 '18 at 23:54

























                    answered Aug 28 '18 at 23:47









                    FarhadFarhad

                    3,24372761




                    3,24372761













                    • The image is old, I checked everything.

                      – Mc.Lover
                      Aug 29 '18 at 7:45











                    • Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                      – Farhad
                      Aug 29 '18 at 11:02



















                    • The image is old, I checked everything.

                      – Mc.Lover
                      Aug 29 '18 at 7:45











                    • Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                      – Farhad
                      Aug 29 '18 at 11:02

















                    The image is old, I checked everything.

                    – Mc.Lover
                    Aug 29 '18 at 7:45





                    The image is old, I checked everything.

                    – Mc.Lover
                    Aug 29 '18 at 7:45













                    Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                    – Farhad
                    Aug 29 '18 at 11:02





                    Ok, let’s do screen sharing, I need to get a more clear view of the problem.

                    – Farhad
                    Aug 29 '18 at 11:02


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51949430%2fchanging-alternate-icon-for-ipad%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    The Sandy Post

                    Danny Elfman

                    Pages that link to "Head v. Amoskeag Manufacturing Co."