John Cashew
John Cashew

Reputation: 1094

The app icon set "AppIcon" has an unassigned child

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.

Upvotes: 30

Views: 40000

Answers (10)

John Cashew
John Cashew

Reputation: 1094

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.

Upvotes: 0

code8x
code8x

Reputation: 1970

In my case my solution was to remove all icons not assigned and adding them via dragging to xCode. That was the fix for me.

Upvotes: 0

Elmar
Elmar

Reputation: 4445

Seems like there are some changes and app icons fail when building with Xcode showing the following errors recently even though file name and Contents.json have matching icon names:

Failed to write image data for the app icon set from "AppIcon.appiconset/120.png" to "/Users/redacted/Library/Developer/Xcode/DerivedData/Runner-gvtobjleqotxoegcxkjxrghpepal/Build/Products/Debug-iphoneos/Runner.app/[email protected]".

Or

The app icon set "AppIcon" has an unassigned child

All previously working icon generator websites failed with similar errors. This is the only one which works:

Icon names:

[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]@1x.png [email protected] [email protected] [email protected]

Contents.json:

{
    "images":[
        {
            "idiom":"iphone",
            "size":"20x20",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"20x20",
            "scale":"3x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"1x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"29x29",
            "scale":"3x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"40x40",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"40x40",
            "scale":"3x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"60x60",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"60x60",
            "scale":"3x",
            "filename":"[email protected]"
        },
        {
            "idiom":"iphone",
            "size":"76x76",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"20x20",
            "scale":"1x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"20x20",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"29x29",
            "scale":"1x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"29x29",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"40x40",
            "scale":"1x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"40x40",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"76x76",
            "scale":"1x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"76x76",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "idiom":"ipad",
            "size":"83.5x83.5",
            "scale":"2x",
            "filename":"[email protected]"
        },
        {
            "size" : "1024x1024",
            "idiom" : "ios-marketing",
            "scale" : "1x",
            "filename" : "[email protected]"
        }
    ],
    "info":{
        "version":1,
        "author":"redacted"
    }
}

Upvotes: 0

RL Shyam
RL Shyam

Reputation: 109

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

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

Upvotes: 0

DarkDust
DarkDust

Reputation: 92384

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.

Upvotes: 4

Doug
Doug

Reputation: 1873

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.

Upvotes: 0

Eliot Gillum
Eliot Gillum

Reputation: 912

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"
  }
}

Upvotes: 0

subodhk
subodhk

Reputation: 254

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.

Upvotes: 0

Jeacovy Gayle
Jeacovy Gayle

Reputation: 457

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

Upvotes: 11

Yao Li
Yao Li

Reputation: 2286

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

Upvotes: 58

Related Questions