简体   繁体   English

如何在Xamarin.Forms中添加iOS的Assets Catalog?

[英]How to add Assets Catalog for iOS in Xamarin.Forms?

I am using Xamarin Forms . 我正在使用Xamarin Forms I was facing one weird issue from the past two days. 过去两天我遇到了一个奇怪的问题。 First I have created App with assets catalog and not included a key for "CFBundleIconName". 首先,我创建了具有资产目录的App,但未包含“CFBundleIconName”的密钥。 Then after just a few minutes, I got an error like 然后在几分钟之后,我得到了一个错误

A value for the Info.plist key 'CFBundleIconName' is missing in the bundle "xxx". 捆绑“xxx”中缺少Info.plist键'CFBundleIconName'的值。

Then after I have tried with assets catalog and removed above key from info.plist file. 然后,我尝试使用资产目录并从info.plist文件中删除上面的密钥。 Then I got an error like 然后我得到了一个错误

Missing Asset Catalog - Your app is missing the asset catalog file 缺少资产目录 - 您的应用程序缺少资产目录文件

If I am removing below lines from a plist file then getting 120X120 icon file missing. 如果我从plist文件中删除下面的行,则会丢失120X120图标文件。

<key>XSAppIconAssets</key>
<string>Media.xcassets\AppIcons.appiconset</string>
<key>CFBundleIcons</key>
<dict>
    <key>CFBundlePrimaryIcon</key>
    <dict>
        <key>CFBundleIconName</key>
        <string>icon</string>
        <key>CFBundleIconFiles</key>
        <array>
            <string>icon-20@2x.png</string>
            <string>icon-20@3x.png</string>
            <string>icon-29@2x.png</string>
            <string>icon-29@3x.png</string>
            <string>icon-40@2x.png</string>
            <string>icon-40@3x.png</string>
            <string>icon-60@2x.png</string>
            <string>icon-60@3x.png</string>
        </array>
    </dict>
</dict>

Are the above lines are necessary to include in plist file? 以上行是否必须包含在plist文件中? What other things are necessary to include in plist file. plist文件中还包含哪些其他内容。

And My project structure is : 我的项目结构是:

在此输入图像描述

What is wrong with my code? 我的代码出了什么问题? How can I add all files and assets? 如何添加所有文件和资产? Any idea? 任何的想法?

Delete all images and those lines from the info.plist. 从info.plist中删除所有图像和那些行。

Your Info.Plist should have the following lines: 您的Info.Plist应该包含以下行:

<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
<key>XSLaunchImageAssets</key>
<string>Assets.xcassets/LaunchImage.launchimage</string>

Add all the required icons to Asset Catalogs/Media 将所有必需的图标添加到资产目录/媒体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 xamarin.forms 应用程序部署到 iOS 设备? - How to Deploy xamarin.forms app to iOS Device? 如何使用Visual Studio在Xamarin.Forms中的不同目标平台之间共享资产和资源? - How to share assets and resources between different target platforms in Xamarin.Forms with Visual Studio? Xamarin.Forms IOS 断点未命中 - Xamarin.Forms IOS Breakpoints Not Hit 如何从Xamarin.forms页面导航到Xamarin.Android模块活动? 如何在Xamarin.iOS中也实现相同的目标? - How to navigate to a Xamarin.Android module activity from a Xamarin.forms Page? How to achieve the same in Xamarin.iOS as well? 如何在Xamarin.forms中使用CheckBox? - How to use a CheckBox in Xamarin.forms? 如何在Windows上发布Xamarin.Forms应用程序? - How to publish a Xamarin.Forms App on Windows? 如何在 Xamarin.Forms 中创建绑定属性? - How to create binding property in Xamarin.Forms? 在VS 2017上创建Xamarin.Forms项目时的空白解决方案¿如何在不使用VS模板的情况下添加Xamarin Forms? - Blank solution while creating Xamarin.Forms project on VS 2017 ¿How to add Xamarin Forms without VS template? 如何访问 Xamarin.forms 中的通讯录(适用于 android 和 iOS)? - How can I access the address book in Xamarin.forms (for android and iOS)? Mac Xamarin.Forms在iOS模拟器上显示图像,但在Android模拟器上不显示图像 - Mac Xamarin.Forms shows image on iOS simulator but not Android simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM