目录
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<!-- -->
<key>desktopIconS</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>desktopIconS</string>
</array>
</dict>
<!-- -->
<key>desktopIconK</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>desktopIconK</string>
</array>
</dict>
<!-- -->
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string></string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>UINewsstandIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string></string>
</array>
<key>UINewsstandBindingEdge</key>
<string>UINewsstandBindingEdgeLeft</string>
<key>UINewsstandBindingType</key>
<string>UINewsstandBindingTypeMagazine</string>
</dict>
</dict>
func changeIcon(to name: String?) {
// 检查应用程序是否支持更换图标
guard UIApplication.shared.supportsAlternateIcons else {
return;
}
// 将图标更改为指定名称的图片
UIApplication.shared.setAlternateIconName(name) { (error) in
// 应用程序图标更改后,打印错误或成功信息
if let error = error {
print("由于以下原因,应用程序图标无法显示 \(error.localizedDescription)")
} else {
print("应用程序图标已成功更改。")
}
}
}
网友评论