pfedotovsky
pfedotovsky

Reputation: 731

Can't add iOS application icons in Visual Studio 2015

I have Xamarin.Forms project and want to add iOS application icons. So I've created Assets Catalog, but when I open it I can't add any icon:

Visual Studio

I'm using VS 2015 Update 2 and the latest Xamarin version. I found a video of how it should work: https://www.youtube.com/watch?v=KZbrLwJwGeE I have no clue why I can't add any icons, any help is appreciated.

Mine Contents.json looks like this:

{
 "images": [],
  "properties": {},
 "info": {
  "version": 1,
  "author": "xamarin"
 }
}

Upvotes: 2

Views: 2215

Answers (2)

Softlion
Softlion

Reputation: 12605

This is a known issue in the Xamarin plugin for VS.

In VS, delete all your asset catalogs. Open your solution in Xamarin Studio Mac. Add an asset catalog. Double clic the .json file in Resources / Images.xcassets / AppIcons.appiconset / and it will open a working editor. Put your icons there. Save the solution.

You can now reopen the solution in VS. Never edit the asset catalog in VS again until this is fixed (could be many months).

Upvotes: 1

Iain Smith
Iain Smith

Reputation: 9703

Are you able to check the Contents.json for AppIcons it might be corrupt? it will be in Images.xcassets>AppIcons.appiconset>Contents.json it should look like this :

{
  "images": [
    {
      "idiom": "iphone",
      "size": "29x29",
      "scale": "1x"
    },
    {
      "idiom": "iphone",
      "size": "29x29",
      "scale": "2x"
    },
    {
      "idiom": "iphone",
      "size": "29x29",
      "scale": "3x"
    },
    {
      "idiom": "iphone",
      "size": "40x40",
      "scale": "2x"
    },
    {
      "idiom": "iphone",
      "size": "40x40",
      "scale": "3x"
    },
    {
      "idiom": "iphone",
      "size": "57x57",
      "scale": "1x"
    },
    {
      "idiom": "iphone",
      "size": "57x57",
      "scale": "2x"
    },
    {
      "idiom": "iphone",
      "size": "60x60",
      "scale": "2x"
    },
    {
      "idiom": "iphone",
      "size": "60x60",
      "scale": "3x"
    },
    {
      "idiom": "ipad",
      "size": "29x29",
      "scale": "1x"
    },
    {
      "idiom": "ipad",
      "size": "29x29",
      "scale": "2x"
    },
    {
      "idiom": "ipad",
      "size": "40x40",
      "scale": "1x"
    },
    {
      "idiom": "ipad",
      "size": "40x40",
      "scale": "2x"
    },
    {
      "idiom": "ipad",
      "size": "50x50",
      "scale": "1x"
    },
    {
      "idiom": "ipad",
      "size": "50x50",
      "scale": "2x"
    },
    {
      "idiom": "ipad",
      "size": "72x72",
      "scale": "1x"
    },
    {
      "idiom": "ipad",
      "size": "72x72",
      "scale": "2x"
    },
    {
      "idiom": "ipad",
      "size": "76x76",
      "scale": "1x"
    },
    {
      "idiom": "ipad",
      "size": "76x76",
      "scale": "2x"
    },
    {
      "idiom": "car",
      "size": "120x120",
      "scale": "1x"
    },
    {
      "size": "24x24",
      "idiom": "watch",
      "scale": "2x",
      "role": "notificationCenter",
      "subtype": "38mm"
    },
    {
      "size": "27.5x27.5",
      "idiom": "watch",
      "scale": "2x",
      "role": "notificationCenter",
      "subtype": "42mm"
    },
    {
      "size": "29x29",
      "idiom": "watch",
      "role": "companionSettings",
      "scale": "2x"
    },
    {
      "size": "29x29",
      "idiom": "watch",
      "role": "companionSettings",
      "scale": "3x"
    },
    {
      "size": "40x40",
      "idiom": "watch",
      "scale": "2x",
      "role": "appLauncher",
      "subtype": "38mm"
    },
    {
      "size": "44x44",
      "idiom": "watch",
      "scale": "2x",
      "role": "longLook",
      "subtype": "42mm"
    },
    {
      "size": "86x86",
      "idiom": "watch",
      "scale": "2x",
      "role": "quickLook",
      "subtype": "38mm"
    },
    {
      "size": "98x98",
      "idiom": "watch",
      "scale": "2x",
      "role": "quickLook",
      "subtype": "42mm"
    }
  ],
  "info": {
    "version": 1,
    "author": "xcode"
  }
}

You could try to edit the xml manually with a text editor to set the filename like so :

{
  "filename": "icon-29.png",
  "size": "29x29",
  "scale": "1x",
  "idiom": "iphone"
},

icon-29.png will then have to be added to the folder AppIcons.appiconset but from your comment I think it will wipe it out again, I think this is a bug and would file it here https://bugzilla.xamarin.com/

Upvotes: 0

Related Questions