Since iOS 10.3 has been released, Apple added a new feature which allows us to change the app icon dynamically, by using setAlternateIconName(_:completionHandler:) method. So far, as mentioned in the method documentation, we have to mention the name(s) of the alternate app icon(s) in the project .plist file, assigned to CFBundlePrimaryIcon key.
Actually, when working with static icons (icons that have been added directly to the app main bundle) it works as expected without any problems:
My question is:
Is it possible -or is there a workaround- to set the alternate app icon dynamically (for instance: icons that have been downloaded from the web and saved in the app documents directory)?
I don't think its possible.
setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox.
Also, most probably Apple reviews the app icons you have bundled for avoiding use of same app icons or icons similar to Apple apps.
Refer: https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname
Related
I know we could change the app icon of the application in iOS 10.3 above and I achieved this successfully, but my question is that could we achieve this using a custom url.
Suppose that the app icon is stored in the backend server and the icon while changed according to the user login in the system. Is it possible?
This is not possible. Any alternate icons must be predefined the the app's info.plist file and are subject to app review.
Check out the documentation here: https://developer.apple.com/documentation/uikit/uiapplication/2806818-setalternateiconname
Apple's Human Interface Guidelines discusses some of the limitations of custom app icons: https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/
Since iOS 10.3 has been released, Apple added a new feature which allows us to change the app icon dynamically, by using setAlternateIconName(_:completionHandler:) method. So far, as mentioned in the method documentation, we have to mention the name(s) of the alternate app icon(s) in the project .plist file, assigned to CFBundlePrimaryIcon key.
Actually, when working with static icons (icons that have been added directly to the app main bundle) it works as expected without any problems:
My question is:
Is it possible -or is there a workaround- to set the alternate app icon dynamically (for instance: icons that have been downloaded from the web and saved in the app documents directory)?
I don't think its possible.
setAlternateIconName(_:completionHandler:) API looks for the icons inside app bundle and cannot be changed to fetch from sandbox.
Also, most probably Apple reviews the app icons you have bundled for avoiding use of same app icons or icons similar to Apple apps.
Refer: https://www.hackingwithswift.com/example-code/uikit/how-to-change-your-app-icon-dynamically-with-setalternateiconname
In an app's Info.plist the developer has the opportunity to declare custom URL schemes supported by the app. The developer may also associate each scheme with an Apple Icon Image (icns) file in the bundle that will serve as an icon.
I have never seen these URL icons used anywhere, and I can't imagine how they even would be used. Is there any purpose to setting them?
That is not an iOS thing, but is instead intended for OS X/macOS.
You can read some about it here on the macOS Human Interface Guidelines page.
I'm fairly new to iOS development and I am porting an Android app to iOS 7. The Android app provides a screen that allows the user to change a number of non persistent settings. Because these are not saved, it doesn't seem appropriate to me to expose them, on iOS, as preferences via a settings bundle and the built-in Settings app. So I'm looking at an in-app settings screen, which I understand is allowed - but perhaps not encouraged - by Apple.
Some questions:
Am I correct that an in-App approach is allowed by Apple? Most example code seems to use settings bundles. Am I going to have problems when the app is submitted to the App Store?
I can put the settings UI in a simple UITableViewController, but is there an approved way to expose this to the user? XCode 5 doesn't provide a settings identifier (and icon) for toolbar buttons, and the "Info" identifier (letter i inside a circle) seems to have been dropped too. Should I use a custom icon? Are there any de facto standards?
I haven't seen this kind of UI element before on iOS but my exposure to the platform as a user is limited.
There is nothing wrong with doing an in-app preference (table)view. You won't be rejected for that (this point seems to be way too much exagerated outside the iOS community). There are guidelines that you can follow: iOS Human Interface Guidelines... or not. As long as you don't use private APIs (assuming you know how to access them anyway), you're fine! So you can use a custom icon, the "i" button, or any UI element that convey the reasonable meaning of providing access to more info/preference.
In your code, you can use the class NSUserDefaults (with the standardUserDefaults) to store your preferences.
Many apps have in-app settings. It's fine. Apple even states that it is fine. Just don't have both.
Use a custom icon. Many apps seem to use an icon that looks like a gear.
I am comfortable with localizing strings and images within the app. But I am having a lot of difficulty trying to localize the app icon for my supported languages (english and german).
Is this even possible? According to the Apple documentation, you can:
An iOS application should be internationalized and have a
language.lproj folder for each language it supports. In addition to
providing localized versions of your application’s custom resources,
you can also localize your application icons and launch images by
placing files with the same name in your language-specific project
directories. Even if you provide localized versions, however, you
should always include a default version of these files at the
top-level of your application bundle. The default version is used in
situations where a specific localization is not available. For more
information about localized resources, see “Localized Resources in
Bundles.”
I have tried to do this with no luck. There doesn't seem to be any helpful resources?
Other things I've tried:
Localized App Icons with Retina Display for iOS
https://iphonedevsdk.vanillaforums.com/forum/iphone-sdk-development/77660-i-have-problem-localizing-application-icon.html
Has anyone successfully achieved a localized app icon?
Since iOS 4.0, this simply doesn't seem to be possible anymore. As of 2015, the documentation has been updated and now only states that Launch Images can be localized (but does not mention App Icons anymore).
The fact that this isn't working has been confirmed by an an Apple employee on the devforums (login required) in 2010:
https://devforums.apple.com/message/330960
Bugreports have been submitted for several years, but nothing has changed. I suppose Apple wants you to use the same icon for your app all over the world – or create separate apps for specific markets.
Actually, there is a way to localize the AppIcon. By using the alternative App Icon. You can change the app icon at the run time.
if Locale.current.language.languageCode?.identifier == "en" {
UIApplication.shared.setAlternateIconName("AppIcon-en") { (error) in
print(error)
}
}