Bug 7734 - Application icons not showing up
Summary: Application icons not showing up
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: iOS add-in ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- major
Target Milestone: ---
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2012-10-08 15:31 UTC by Pierce Boggan [MSFT]
Modified: 2012-11-02 16:58 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Mikayla Hutchinson [MSFT] 2012-10-09 16:14:24 UTC
Going forwards, I suggest that we try to move icon files to Resources/{AppleName}.png with BundleResource build action, and use the {AppleName} in the Info.plist.

When adding the file via the info.plist editor, MD should allow picking files from anywhere on disk.

If the file is already included in the project, and the resource ID matches the apple-approved name, we're goo, just add the ID to the Info.plist. If it's in the project but the ID does not match, MD will offer a choice: "This file is already included in the project. Would you like to move or copy it to the required location? [Move] [Copy] [Cancel]". If the user chooses "move", the existing ProjectFile will be removed. If the file is not already included in the project, MD will just silently copy it.

Coping with existing Content files that depend on the old behaviour is harder. I would suggest that we restore the old magic renaming. The icon content collecting code will, for each icon in the plist:
1) if the ID matches the apple recommended ID, or a BundleResource item with that ID exists, do nothing
2) if a file with that name exists, generate a content pair, but with the output mapped to the apple recommended ID
The info.plist code will, for each icon in the plist:
1) if the ID matches the apple recommended ID, or a BundleResource item with that ID exists, do nothing
2) replace it with the apple recmmended ID
The content collecting code will, for each content file:
1) if the info.plist has an icon with that filename, skip it
Comment 2 Jeffrey Stedfast 2012-10-10 17:21:01 UTC
Part of the problem with this test case appears to be that the file names are way too long(???).

If I shorten them, it appears to work.
Comment 3 Jeffrey Stedfast 2012-10-10 17:22:17 UTC
I've made a bunch of other fixes wrt selecting icons where it now names them with the Apple-preferred names if they aren't already part of the project.
Comment 4 David Jeske 2012-11-02 01:01:56 UTC
From my tinkering to get my MonoTouch iOS app-icon to work:

Problem #1: an iOS application icon MUST be in the top-level of the app wrapper, and MUST be named "Icon.png" to work on iphone, and "Icon@2x.png" to work on iphone retina. The simulator and iPad are somehow more tolorant of icon naming and location. See this Apple documentation page for confirmation..


Problem #2: The MonoDevelop plist editor does not work properly for a number of reasons. First is that it does not do #1 above, it just copies the file to the top-level of the app directory while retaining it's original name (which does not work on iPhone). Second is that it doesn't delete existing plist entries when you choose new icon files to replace old ones. (or at least it didn't for me). I had to load the plist up in XCode and delete all the App icon entries. (though once the build is fixed for #1, there should just be a plist entry for Icon.png)

To fix this:

(1) The MonoTouch build should copy and RENAME app icons to the top-level app directory according to apple's spec above (i.e. Icon.png, Icon@2x.png)

(2) The plist editor should be fixed to have the correct plist entries, and not leave lingering plist entries around.
Comment 5 David Jeske 2012-11-02 01:05:36 UTC
After re-checking the apple developer page, I see the fixed filename app icon is only necessary for older versions of iOS... Perhaps there really is an issue with longer filenames. Regardless, there is an issue where the plist editor does not properly remove old keys when you pick new icons.
Comment 6 Jeffrey Stedfast 2012-11-02 14:52:35 UTC
Thanks for the update, David.

I'll look into fixing the code that does not clean out older icon entries from the Info.plist.

I've already changed the code to put the icons into a Resources folder and names them Icon.png, etc.
Comment 7 Jeffrey Stedfast 2012-11-02 15:18:15 UTC
Looks like I fixed the lingering plist entries bug when I did the naming fix.

Unfortunately, these changes have gone into the 4.0 branch and not the 3.0 branch (I took a look at back-porting them, but I'd have to pull in a huge amount of changes), so the fix won't be in 3.0.6. They will, however, be in 4.0

Sorry about that and thanks a ton for helping me debug this!
Comment 8 David Jeske 2012-11-02 16:37:56 UTC
NP.... just for clarity, I'm pretty sure they need to be in the root-directory, not a resources folder.... 

I have everything working by making my app icons be "<approot>/Icon.png" and "<approot>/Icon@2x.png" and then adding them to the plist using the editor.
Comment 9 Jeffrey Stedfast 2012-11-02 16:58:07 UTC
Right, they need to be installed into the root directory of the app bundle.

What I meant was that we've added a Resources folder to MonoTouch projects so that you don't have to clutter your MonoTouch project with tons of icons in the root project directory :-)