问题描述
我正在尝试为Mac上的xamarin Forms ios项目设置启动器图标.
I am trying to set the launcher icon for xamarin forms ios project from Mac.
我做了以下事情,但仍显示默认图标.
I do the following things but still showing the default icon.
1.双击解决方案资源管理器中的Info.plist文件以将其打开以进行编辑.
1.Double-Click the Info.plist file in the Solution Explorer to open it for editing.
2.向下滚动到应用程序图标"部分.
2.Scroll down to the App Icons section.
3.从Source下拉列表中,选择AppIcon-1.
3.From the Source dropdown list, select AppIcon-1.
4.打开Assets.xcassets,然后从列表中选择应用程序图标.
4.Open Assets.xcassets and select App icons from the list.
5.选择所需类型的图像文件(未选中"Prerendered"选项).某些图标已经填充了默认图标,如果我更改该图标,将会得到找不到文件的错误.
5.Select the image file for the required type(Prerendered option is not checked). Some icons are already filled with the default icon and if I change that will get the file not found error.
Info.plist中的XSAppIconAssets路径为:
XSAppIconAssets path in Info.plist is:
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon-1.appiconset</string>
此任务还有其他设置吗?我引用此博客: https://docs.microsoft.com/zh-cn/xamarin/ios/app-fundamentals/images-icons/app-icons?tabs=vsmac
Is there any additional set up for this task? I refer this blog: https://docs.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/app-icons?tabs=vsmac
谢谢.
推荐答案
这是因为Assets file path
与info.plist
中的值不匹配,因此您的应用程序找不到它,因此请使用默认图标.
It is because that Assets file path
doesn't match the vaule in info.plist
, your application cannot find it so use the default icons.
-
右键单击
info.plist
并用XML(Text)Editor
打开,即可找到
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcons.appiconset</string>
右键单击Assets.xcassets
并打开包含文件夹,选择其父文件夹,您会发现它位于YourApp.iOS
而不是Resources
.
Right click Assets.xcassets
and open containing folder , select its parent folder, you can find it locates at YourApp.iOS
not Resources
.
解决方案
将XSAppIconAssets
从Resources/Images.xcassets/AppIcons.appiconset
更改为Images.xcassets/AppIcons.appiconset
,它应该能够解决该问题.
Solution
Change XSAppIconAssets
from Resources/Images.xcassets/AppIcons.appiconset
to Images.xcassets/AppIcons.appiconset
, it should be able to solve the issue.
这篇关于Xamarin形式:iOS的启动器图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!