iPhone - Change app icon pointed to by info.plist within the application? - iphone

Is there any way to change the 47x47 PNG, pointed to within info.plist, for the iPhone springboard icon from within code?
I understand I can add a translation and change the springboard icon per language that the iPhone supports via a changed info.plist per language, but I would like to change the springboard icon for my iPhone app based on a user preference within the app.
Any ideas?
I haven't tried this, but can a file be copied over another within an app bundle? Could I ship with info.plist pointing to "base.png" then replace "base.png" with another PNG I package with my app from within code?
Thanks.
--Batgar

This cannot be done - an iPhone application main bundle is read only, so you cannot change your app icon from within your app.

What you want to do is create a new target (with the relevant icon) for each "sister" app and that will allow you to compile multiple apps using the same code base. Hope this helps!

Related

How to specify different dock icon in Swift for macOS App

My app icons are a light blue with clear background and I find that it doesn't show up nicely in the macOS dock.
I'm trying to find a way to use a different icon for the dock icon only but can't seem to find a way to do it programatically or through Xcode.
The dock icon I created does adhere to the Apple HIG guidelines however I'm not distributing through the App Store anyways.
Can anyone help me out?
I'm using XCode 13 with Swift 5.
Setting NSApp.applicationIconImage should do what you need.
EDIT: If you need to display a custom icon even when the app is not running, you need to make a dock tile plugin. Unfortunately, documentation on this is pretty scarce, but basically you need to make a plugin target, embed it inside your app's bundle with the extension .docktileplugin, put the path to your plugin in your app's Info.plist under the NSDockTilePlugIn key, and then make the plugin's principal class implement the NSDockTilePlugIn protocol. Also keep in mind that dock tile plugins are not allowed in the Mac App Store, so you'll need to self-publish with a Developer ID certificate if you go this route.

ios11 iphone app icon is missing on iPad

I have an iPhone only app but it works in compatibility mode in the iPad too(no surprises).
but after I updated the app for the ios11, app icon on the iPad is missing.
here is what I've tried;
- launch on the iPhone simulator, icon appears
- launch on the iPad simulator, icon is missing
change the device options from "iphone" to "universal", run the iPad simulator, icon appears but app needs a new iPad ui.
change back to "iPhone" and the app icon is missing again in iPad. really confusing.
I tried to create a new project and make the same changes but never able to make the icon missing again.
I'm using cocoa pods if that makes any sense.
I think I'm missing a settings or something else, I'm really trying to find it, any advice would be greatly appreciated.
I've found the problem.
In info.plist, there was an extra or problematic entry.
- CFBundleIcons~ipad
Remove this line and iPad icons appear normally.
This problem has been reported by many users over the past 6 months (including desperate pleas to Apple to fix this bug), yet no one's reported the following solution.
I'm using Xcode 9.2, and I noticed today that my iPad/iPhone's application will run fine on my iPad (iOS v11.2.1) but the icon is missing.
This is a legacy app, about 2-3 years old, and the cause seems to be my Appicon file. When I view this file, I see this:
Previously, this resource was sufficient to provide the app icon for both the iPad and iPhone, but apparently, not anymore.
I went into my Images.xcassets file, right-clicked, and selected "App Icons & Launch Images\New IOS App Icon" and now have a look at the extra icon possibilities:
Notice the extra icons for iPads.
Sure enough, I created yet more .png files, with resolutions matching the desired iPad resolutions settings, and now, when I build my app and run it on the iPad, it does show the correct icon.
Oh, and I also needed to go into my project's build settings, select the "General" tab, and change the "App Icons Source" to the name of my new image set, "AppIconNew".
Et voila. No messing around with Cocoapods, no need to change the .plist file (mine didn't have that "CFBundleIcons~ipad" entry anyway), I just needed to create a new image set.
Okay, time to go back to my modern, cosy world of using Visual Studio again now.
(Happy sigh..)
I've had a few legacy apps that did have the CFBundleIcons~ipad in the Info.plist, so I check that first. However, I've also had instances where it was just missing the asset as #Mike Gledhill mentioned. If this is the case, you don't have to go through adding a new AppIcon set. Just check the iPad box in the Attributes Inspector for the current AppIcon assets and the iPad sizes will show in the current set. Then just add the correct assets for each size requirement.
I didn't have CFBundleIcons~ipad entry in my Info.plist file as per "karpat"s answer. So I moved to "Mike Gledhill"s answer, then after observing my all the icons from Image assests, I found that for particular icon which was invisible only on iPad, the device type set was iPhone.
I just changed device type by right cling on image set to Universal :
This did work for me.

PNG within an iPhone app

I have the following issue:
My iPhone app makes some kind of graphics.
How can I save these graphics or drawings made by the app as a png file on the device?
Would it then be possible to set such a png file to become the icon for the app from within the app itself? (Provided the size is right of course.)
Thanks for any possible tip.
No, you can't change the app's icon at runtime (like the Calendar app that comes with the iPhone does)
How do I change the default icon of iPhone application programmatically?
For saving PNG images on your device, look into UIImagePNGRepresentation which is part of the UIImage Class.
As for changing the app icon, this would only be possible if you are jailbroken and have the right package dependencies that allow the icons to refresh in SpringBoard on the fly.
Outside of being Jailbroken, changing the app icon would require an app update which would include the new icon.
I wouldn't think it's possible for the actual icon for the app to change, because it's set on the phone when the app is installed.

iphone app only showing in little window on ipad

I have developped an iPhone app and I now need it to work on iPad. On the simulator the app only show in a little window (the x2 zoom enable the app to work in full screen) but is there a way to have the app directly showing in full screen ?
Thanks a lot,
Luc
go to project settings and set Targeted Device Family to iPhone/iPad
As Max said, go to project setting and set Target Device Family to iPhone/iPad. But this is not enough. With this change the application type will be universal application. This is good, because the app will start in full screen, but if you hard coded the dimensions of the views in the application then the look and feel on the iPad will be bad. So do the first step what Max suggested for you and then check if the app looks like you want, because it will not arrange the views automatically. You should do the changes from code or from nibs.
There is a little help if you set properly the autoresizing masks.
Edit:
Project menu -> Edit Project settings -> Targeted device family
You will need to do at least the following:
Change the Targeted Device Family to include the iPad.
Create or convert all needed .xibs for the iPad (using the Interface Builder Menu).
Reference the top level iPad .xib from your app's info.plist (using the NSMainNibFile~ipad key).
Handle the iPad paradigm wherever the controller or view source code needs to differ.

Iphone working with icons

I want to write a simple program which can customize iphone icons like their positions or something like theme creators. and I want to know how some programs' settings are in the iphone main setting tab. I really need help.
thanx in advance
If you mean you want to retheme the springboard (the place where apps icons are displayed) you can't. If you want to retheme things inside your own application it is doable, but it really depends on the design of your application.
To get your apps settings into the Settings app you just need to add a Settings.bundle to your app, which a plist describing the preferences. There is documentation for it here.
There's an app that already does this for jailbroken iPhones. It's called iconoclasm, you can get it from Cydia.