简体   繁体   中英

Xamarin warning: The app icon set "AppIcons" has 2 unassigned children

I'm getting the following warning when compiling:

Warnings:

/Users/some-user/Projects/SomeApp/SomeApp/SomeApp.csproj (Build) -> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets (_CoreCompileImageAssets target) ->

Resources/Images.xcassets: actool warning : The app icon set "AppIcons" has 2 unassigned children.

1 Warning(s)

I have provided each image for the app icons (except watch/car). There is no "unassigned" value in the Contents.json file. I also tried to unset every image and set it again. I'm still getting the warning.

Currently I'm using Xamarin Studio 5.9.7 (build 22), Xamarin.iOS 9.0.1.29 with Mono 4.0.4., Xcode 7.0.1 (8228) Build 7A1001. All this runs on Mac OS X 10.10.5.

How do I get the warning removed?

If you have icons in .\\AppIcons.appiconset folder that is not used/referenced in Contents.json file then you will the warning "The app icon set "AppIcons" has * unassigned children.". Look at all the icons in the folder and go through all the icons referenced in Contents.json then remove extra icons from the folder. Icons that is not referenced even though not included in the project will result in the compiler warning.

iOS 9.2.1, Xcode 7.2.1, ARC enabled

If the JSON file looks good, then the asset catalog might just be corrupt; this sometimes happens when you drag and drop files in and maybe accidentally removing a file from the folder at path, or changing the path in Xamarin for the asset.

Either way, see if Xamarin has some sort of way of deleting the asset catalog and adding it in again, then specifying what iOS target and device your app is going to run on to configure the asset catalog correctly.

You will have to add each asset again to the asset catalog once the catalog is set up.

Hope this helps. Cheers!

I had the same problem. I had clean up the project and recompile it and all was fine. Also when an icon was missing it was only added when I clean up the project.

I had the same problem with VS for Mac, Xamarin, Xcode 9.2. After adding my app icons to Assets.xcassets, I saw the 'Appicons unassigned children' error. The solution that worked for me was to exit Visual Studio and restart it. After restarting Visual Studio, build proceeded without errors.

I had a similar problem caused by (possibly) corrupt Contents.json. My Media.xcassets was under a Resources directory. I recreated the asset catalogue from scratch and now it seems to work properly.

Steps:

  1. Back up your Media.xcassets directory.
  2. Create a new AppIcons asset (In Solution view, navigate to iOS project > Asset Catalogs and double-click Media
  3. Click the Add button (top left corner) and choose Add App Icon and Launch Image -> Add App Icon. This creates a new AppIcos.appiconset directory (probably in your project root) and generates an empty Contents.json file.
  4. Add the necessary icons using the corresponding "..." buttons.
  5. See if you still get compilation warnings.
  6. If you wish to move Media.xcassets under Resource or other directory:
    1. Move Media.xcassets to the desired subdirectory
    2. Open Info.plist and .the project .csproj file in a text editor and manually edit all the ImageAsset tags to change their directories from Media.xcassets to Resources\\Media.xcassets. Make sure there are no duplicate lines referring to the same assets.
  7. Remove backup Media.xcassets directory

Another time I got the same warning. Because it is an iPad only app I had this in the concerned Contents.json from the xcassets :

  "images": [
    {
      "scale": "1x",
      "idiom": "ipad",
      "filename": "Group@1x.png"
    },

I changed it to this

  "images": [
    {
      "scale": "1x",
      "idiom": "universal",
      "filename": "Group@1x.png"
    },

and the error was gone. You have to do this for every entry.

I got also got another warning with the above:

MyApp/MyApp.iOS/obj/iPhone/Debug/device-builds/iphone12.1-13.7/actool/cloned-assets/Assets.xcassets : actool error : Cannot enable on demand resources for the platform "iOS" when targeting releases prior to 9.0. Consider disabling the ENABLE_ON_DEMAND_RESOURCES build setting.

By upgrading from 8.0 to 9.0 the errors were gone for me. I also think the problem came from creating a ImageSet in `Assets.xcassets.

My iOS csproj file has old references to deleted files of old xcassets. Just edit the .csproj file and remove these extra references.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM