我正在尝试在我的iOS应用程序中设置名为MyIcon
的备用应用图标。 我的项目包中有一个MyIcon.png
图像(不在我的Assets文件夹中),并且在我的Info.plist中声明如下:
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>MyIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>MyIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
</dict>
在我的代码中,我尝试更改应用程序图标:
UIApplication.shared.setAlternateIconName("MyIcon")
然而,图标没有改变,相反,我在控制台中收到了这个错误:Error Domain=NSCocoaErrorDomain Code=3072 "The operation was cancelled."
我该如何解决这个问题?