Is it possible to change the app icon programmatically? - iphone

I want to make two different app icons, and programmatically switch betweem then. When the user quits the app without finishing an workflow-process, then I want to switch to an icon that will indicate that there's something undone when launching the app. Well, just theoretically, just for testing.
I think that the icon file is just a normal file as any other, so if I would just rename it programmatically and then give another icon file the name of the icon file that's named the Info.plist, then the app should show up with another icon, right? Would that be possible? Or do I have no access to that file for renaming it?

icon file stored in "application bundle" folder.
And your application has read-only rights to this folder
There is no oficial way to change/rename thees files.
You can add integer badge to youy icon
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:666]
But it is not official method.

It sounds like a good idea, and I would definitely give it a try, but I get the feeling this isn't possible.
I believe the app icons get stored in another file structure global to the iPhone. I say this because after I installed 3.0 beta 5, I saw a bug where the app icon disappeared from an app I developed. Then after installing two new apps from the app store, the new app's icon appeared on my app, and the 2nd new app's icon appeared on both new apps. Essentially the new app icons shifted to fill in for the missing app icon.
Removing and re-adding the apps, then rebooting the phone, restored the icons properly.
I don't know for a fact how the app icons are managed and stored on the phone, of course, but it would fit to say they are stored in some sort of cached list that gets rebuilt occasionally, perhaps after a reboot. That would mean even if you could change the icon from within your app, it would take more effort to see the effects on the phone.

Related

NSWorkspace.shared.icon(forFile:) does not return icon image

I am working on a MacOS application where the app should show the application icons. For some app it works, for some apps it don't.
One the app for which I do not get the application icon image is the Notes.app.
let icon = NSWorkspace.shared.icon(forFile: "/Applications/Notes.app")
For Numbers.app, for example, it is loading the app icon as expected.
What is the reason behind?
I have figured out that icons are only appearing for those applications where the application has an associated filetype. Applications which do not have associations does not return the icon.
There must be a was to open an .icns file. The path to it is clearly accessible and the content of the icon file should be too.
Ok. I have figured out that some Applications are located under /System/Applications, but appears under /Applications too. This is causing the problem above.

Resetting iPhone Application

I have an application that is currently named "xxxx". The app runs and works perfectly without any problems. However, I have reached a stumbling point. When I try to load the application onto my iPhone, the pictures on my picker view seemed to have disappeared for some strange reason. I've done multiple hours of debugging and everything checks out normal. I then decided I wanted to change the product name from "xxxx" to "xxxx Redo". As soon as I did that, the application loaded perfectly normal (with the pictures in the Picker View as it should be).
In conclusion, it comes to find out that there is no actual bug in the programming aspect of it. However, my question comes up as to why does it not load the correct way with the original product name but then loads the right way when the product name is changed?
The second part of my question is if anyone knows of a way to fix the original application so that way it displays correctly again with the original name?
I have tried the following:
Cleaning the app
Trashing the .app file and rebuilding
Deleting the app on the iPhone and rebuilding.
These things sometimes just happen, you can try the following extra steps:
clean build folder in XCode (press alt while clicking Product menu)
reboot the phone (poweroff/poweron)
I have seen cases where it made a difference.

How to change app icon within In-App Purchase?

Is it possible even to change from demo icon to full version image after purchasing full version via InApp Purchase? Or should I make two versions with lite/full icons ?
Please refer to
https://stackoverflow.com/a/45602449/195186
This was true before iOS 10.3 only:
No. This is not possible. The icon is fixed.
UIApplication has a new instance method that will do what you want. The Apple docs spell out exactly what you need to do to accomplish this: https://developer.apple.com/documentation/uikit/uiapplication/2806818-setalternateiconname
This is not possible, since iOS apps run in a sandbox and can therefore not write (while they can read) the app's bundle, where the icon is located.
1) In info.plist set up key Icon file with value ../Documents/icon.png.
2) Add key Icon already includes gloss effects with value YES
3) In first launch move picture to /Documents/icon.png
After second launch Icon app will be changed!
If you change icon.png in Documents folder need to make respiring for refresh Icon app.

How do I change the text directly beneath the icon of my iphone app

There is small text beneath the icon names when you are in the home screen of the ipod.
My text is much too long and it looks like "Cedr..egg"
I was wondering if there was a way to change that text to a shorter name?
I think what you're looking for is Bundle Display Name in the info.plist file.
You can change the name of the app by renaming the app in the Applications folder in iTunes.
If you are looking to do this in Xcode you are looking for the LocalizedApplicationNames.strings file.
NOTE: This may prevent automatic upgrades in the future.

Can an iphone app change its home screen icon and name after installation?

Can an iphone app change its home screen icon and name after installation?
What i want to do is make a generic application for several of our clients, that upon installation and login by users it detects which of our client it applies to and changes its icon and name to reflect the appropriate branding.
Is this going to be possible? Or are we simply going to have to make (and submit for approval...) one app per client?
Thanks
Updated: since iOS 10 it's possible to change the application icon from the list of pre-defined ones in the Info.plist. However display name still stays the constant.
Outdated: Since app's name is in Info.plist which resides with app's icon in app's bundle (which is readonly) - it cannot. You can only change your app's name and icon after releasing an update into the appstore. You may though change application icon's badge value. But as I see in your scenario - it won't fit your needs at all.