26

I clean built my app and see this error message: The app icon set "AppIcon" has an unassigned child.

When I view Images.xcassets every icon slot is filled with the correct icon and there are no unassigned icons. In the past XCode seemed to randomly forget the slot for an icon and put it underneath all the labeled icon slots. On those occasions I dragged the icon back to the correct slot and the error went away. There are also no errors about any Icons being the wrong size.

I checked Images.xcassets/AppIcon.appiconset/Contents.json and there are no entries in the JSON that have a blank filename.

I'm using XCode 7.2.

I would appreciate any help.

John Cashew
  • 1,078
  • 2
  • 12
  • 28
  • Have you tried adding another App Icon set and just moving the same images over to that? – jervine10 Feb 10 '16 at 16:24
  • @jervine10 Do you mean adding another Icon set to the same asset catalog, or creating a new asset catalog? Would this potentially fix the problem? Or is this a way of discovering the source of the problem? – John Cashew Feb 10 '16 at 16:32
  • I mean adding another Icon Set. If you aren't seeing any unassigned images it might be that there's an internal bug somewhere. Creating a new icon set and seeing if the problem persists may rule this option out and it's simple to do. – jervine10 Feb 10 '16 at 16:33
  • 1
    @jervine10 Thank you. I noticed that 4 of the icons had a dash in their name in Content.json, but don't have a dash in their name in the Navigator or in the filesystem. I removed and readded these and the warning went away. When I readded them only 2 have the dash in Content.json. – John Cashew Feb 10 '16 at 16:41

8 Answers8

48

Select the unassigned image and delete it via delete button. Clean and Build.

Yao Li
  • 2,071
  • 1
  • 25
  • 24
10

Ran into this same error but solved it in a different way.

In the project navigate to Assets.xcassets/AppIcon.appiconset/Contents.json and open this JSON file.

Review and remove any unnecessary set of icons.

For me, it was a group of iPad icons (seeing that the application was only iPhone compatible, it was not needed).

Once removed, Clean - then - Build

Jeacovy Gayle
  • 447
  • 9
  • 9
3

And another cause for this error: difference in filename case on disk and in Content.json. They need to match.

In my case, the filenames on-disk were all lower-case and that's how they were referenced in Content.json. Then I got new images, they were uppercased, and I just dragged them into Xcode to update them. Now on-disk and Content.json were both referring to the files uppercased.

But Git didn't pick that change in case up, it just thought the files were updated and did not change the case. So on the build server, I ended up with lower-cased filenames, but Content.json was referring to them upper-cased. Needed to lower-case them on my system and fix the Content.json.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
0

I noticed that 4 of the icons had a dash in their name in Content.json, but don't have a dash in their name in the Navigator or in the filesystem. I removed and readded these and the warning went away. When I readded them only 2 have the dash in Content.json.

This was probably an XCode bug.

John Cashew
  • 1,078
  • 2
  • 12
  • 28
0

Check if you have selected the correct image size. If it shows to put a 80x80 size image then you have to put an 80x80 size only, not less not more.

subodhk
  • 244
  • 3
  • 5
0

I have a degree in Computer Science and I'm embarrassed to say how long I've spent on getting app icons to work for my watchOS app.

Here's what I think I've learned:

  • Make absolutely 1000% sure that what's in Info.plist matches exactly what's in Contents.json (including the path to it, which defines the name of the set) and ALSO MATCHES what's in the .csproj file (ItemGroup/ImageAsset). If you have any files used multiple times in your Info.plist, only list them once in your .csproj. Edit these files in text mode. Copy/paste is your friend.
  • Make sure the Info.plist has forward slashes while the .csproj has back slashes. Copy/paste is your enemy.
  • Don't have extra files in your asset directory or in your .csproj--that's where the "unassigned child" warnings come from
  • If you use Visual Studio to open your Asset Catalog and it shows anything is setup incorrectly, let it fix it or use it to fix, then go back and edit/verify the Content.json and .csproj manually
  • I also put <key>CFBundlePackageType</key><string>APPL</string> and called it AppIcons.appiconset although I'm not sure either of these were important

I'm pasting my full Contents.json below. I pulled it from the Xamarin sample "WatchKitCatalog."

Godspeed and good luck to you.

{
  "images": [
    {
      "scale": "1x",
      "size": "1024x1024",
      "idiom": "watch-marketing",
      "filename": "icon1024.png"
    },
    {
      "role": "notificationCenter",
      "subtype": "38mm",
      "scale": "2x",
      "size": "24x24",
      "idiom": "watch",
      "filename": "icon48.png"
    },
    {
      "role": "notificationCenter",
      "subtype": "42mm",
      "scale": "2x",
      "size": "27.5x27.5",
      "idiom": "watch",
      "filename": "icon55.png"
    },
    {
      "role": "companionSettings",
      "scale": "2x",
      "size": "29x29",
      "idiom": "watch",
      "filename": "icon58.png"
    },
    {
      "role": "companionSettings",
      "scale": "3x",
      "size": "29x29",
      "idiom": "watch",
      "filename": "icon87.png"
    },
    {
      "role": "appLauncher",
      "subtype": "38mm",
      "scale": "2x",
      "size": "40x40",
      "idiom": "watch",
      "filename": "icon80.png"
    },
    {
      "role": "appLauncher",
      "subtype": "40mm",
      "scale": "2x",
      "size": "44x44",
      "idiom": "watch",
      "filename": "Mark_NoType_SM_Trans88x88.png"
    },
    {
      "role": "appLauncher",
      "subtype": "44mm",
      "scale": "2x",
      "size": "50x50",
      "idiom": "watch",
      "filename": "Mark_NoType_SM_Trans100x100.png"
    },
    {
      "role": "quickLook",
      "subtype": "38mm",
      "scale": "2x",
      "size": "86x86",
      "idiom": "watch",
      "filename": "icon172.png"
    },
    {
      "role": "quickLook",
      "subtype": "42mm",
      "scale": "2x",
      "size": "98x98",
      "idiom": "watch",
      "filename": "icon196.png"
    },
    {
      "role": "quickLook",
      "subtype": "44mm",
      "scale": "2x",
      "size": "108x108",
      "idiom": "watch",
      "filename": "Mark_NoType_SM_Trans216x216.png"
    }
  ],
  "properties": {},
  "info": {
    "version": 1,
    "author": "xcode"
  }
}
Eliot Gillum
  • 832
  • 9
  • 18
0

I had this problem of unassigned child when there was special characters in the names of the image files. After removing the special characters, the problem was resolved.

Doug
  • 1,643
  • 2
  • 13
  • 10
0

in my case the filenames from contents.json magically disappeared.

have replaced the contents of contents.json file from a new flutter project.

Dharman
  • 30,962
  • 25
  • 85
  • 135
RL Shyam
  • 109
  • 1
  • 2
  • 12