Xamarin Forms: iOS应用程序启动图标

3

我正在尝试从Mac为Xamarin Forms iOS项目设置启动器图标。

我已经完成以下步骤,但仍显示默认图标。

1.在“解决资源管理器”中双击Info.plist文件进行编辑。

2.向下滚动到应用程序图标部分。

3.从源下拉列表中选择AppIcon-1。 enter image description here

4.打开Assets.xcassets并从列表中选择应用程序图标。

5.选择所需类型的图像文件(不选Prerendered选项)。一些图标已填充默认图标,如果更改会得到文件未找到错误。

enter image description here

Info.plist中的XSAppIconAssets路径为:

<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon-1.appiconset</string>

这个任务还需要进行其他设置吗?我参考了这篇博客:https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/app-icons?tabs=vsmac

提前感谢。

1个回答

2

这是因为Assets file pathinfo.plist中的值不匹配,导致应用无法找到它,从而使用默认图标。

  1. Right click info.plist and open it with XML(Text)Editor, you can find

    <key>XSAppIconAssets</key>
    <string>Resources/Images.xcassets/AppIcons.appiconset</string>
    
  2. Right click Assets.xcassets and open containing folder , select its parent folder, you can find it locates at YourApp.iOS not Resources.

    enter image description here

解决方案

XSAppIconAssetsResources/Images.xcassets/AppIcons.appiconset更改为Images.xcassets/AppIcons.appiconset,即可解决该问题。


@SreejithSree 没有资源仍然无法工作吗? - ColeX
<key>XSAppIconAssets</key> <string>Assets.xcassets/AppIcon-1.appiconset</string> 我的 info.plist 中 XSAppIconAssets 的路径 - Sreejith Sree
问题已经编辑并附上了一些截图,您能否查看一下? - Sreejith Sree
@SreejithSree,您应该将2x和3x做成同一个文件,尝试删除“AppIcon-1”并创建新的。 - ColeX
这次它成功了,上次在选择2倍和3倍文件时出现了文件未找到错误,但是这次没有错误并且成功了,为什么? - Sreejith Sree
@SreejithSree 很难说,但根据我的经验,当出现奇怪的情况时,您可以尝试重新启动Visual Studio :).. - ColeX

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接