When I build and deploy to an iPhone, I can call UIApplication.shared.setAlternateIconName
just fine. When I run on an iPad Pro, I get the following error:
Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." UserInfo={NSUnderlyingError=0x1c0857700 {Error Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found in CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}}
Using the following code:
UIApplication.shared.setAlternateIconName(icons[indexPath.row].name) { err in
if let err = err {
print("Woops ! \(String(describing: err))")
}
}
I have standard, 2x, and 3x versions of each icon ranging from 60x60, 120x120, and 180x180. These images are placed loosely in the project, not in an assets bundle.They are referenced in my Info.plist.
What is going on? Why is there a difference between iPhone and iPad?
A separate CFBundleIcons entry in Info.plist is needed specifically for the iPad. It must be named CFBundleIcons~ipad. Just copy your current CFBundleIcons entry and rename it.
You have to add images for the ipad resolutions too. And they're name must be something like icon@2x~ipad.png
. That ~ipad
is the difference
The sizes for ipad are
iPad Pro 167px × 167px (83.5pt × 83.5pt @2x)
iPad, iPad mini 152px × 152px (76pt × 76pt @2x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With