Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Changing iOS app icon



  • Hello, I'm having trouble setting an app icon when building for iOS.

    I was following Platform Notes - iOS article, and I've managed to add an icon to my app after editing the Info.plist manually.
    However, this doesn't seem to be a viable solution, since a new version of Info.plist file is generated each time I do a Qt build. Also, app icon after I tab out of it seems to be missing:
    Image

    Adding elements to Info.plist in the .pro file seems to be impossible.

    Is there a proper way to do this?


  • Moderators

    hi @Augustas

    usually one makes a copy of the info.plist file and store that copy inside your source files.
    than inside the pro file you specify the path to that stored info.plist file via QMAKE_INFO_PLIST variable. For example:

    ios{
        QMAKE_INFO_PLIST = iOS/Info.plist
    }
    

    changing the AppIcon, or adding one in your case, requires a complete reinstall and cache cleaning to be visible. Its been that way in iOS for a long time :(



  • hi @J-Hilk, thank you for the reply :)

    The solution seems kind of a hassle, but hey, it works!

    I can see the icon when my app is on my home screen, however, the issue persist, that I can't see an icon when the app is tabbed out (as shown in screenshot before). I'm testing this on an iPhone 5SE with iOS software 14.8.1
    In "Platform Notes - iOS" article there's a mention "The filename is not important, but the actual pixel size is.", I've tried all kinds of icon sizes, I've added all of them to QMAKE_BUNDLE_DATA, but the tabbed out app icon still isn't present. My Info.plist file looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>CFBundleDisplayName</key>
    	<string>TestApp</string>
    	<key>CFBundleExecutable</key>
    	<string>${EXECUTABLE_NAME}</string>
    	<key>CFBundleIconFile</key>
    	<string>${ASSETCATALOG_COMPILER_APPICON_NAME}</string>
    	<key>CFBundleIcons</key>
    	<dict>
    		<key>CFBundlePrimaryIcon</key>
    		<dict>
    			<key>CFBundleIconFiles</key>
    			<array>
    				<string>AppIcon20x20.png</string>
    				<string>AppIcon29x29.png</string>
    				<string>AppIcon29x29@2x.png</string>
    				<string>AppIcon40x40@2x.png</string>
    				<string>AppIcon57x57.png</string>
    				<string>AppIcon57x57@2x.png</string>
    				<string>AppIcon60x60.png</string>
    				<string>AppIcon60x60@2x.png</string>
    				<string>AppIcon29x29~ipad.png</string>
    				<string>AppIcon29x29@2x~ipad.png</string>
    				<string>AppIcon40x40~ipad.png</string>
    				<string>AppIcon40x40@2x~ipad.png</string>
    				<string>AppIcon50x50~ipad.png</string>
    				<string>AppIcon50x50@2x~ipad.png</string>
    				<string>AppIcon72x72~ipad.png</string>
    				<string>AppIcon72x72@2x~ipad.png</string>
    				<string>AppIcon76x76~ipad.png</string>
    				<string>AppIcon76x76@2x~ipad.png</string>
    				<string>AppIcon87x87.png</string>
    				<string>AppIcon120x120.png</string>
    				<string>AppIcon167x167.png</string>
    				<string>AppIcon180x180.png</string>
    				<string>AppIconiTunesArtwork.png</string>
    				<string>AppIconiTunesArtwork@2x.png</string>
    			</array>
    		</dict>
    	</dict>
    	<key>CFBundleIcons~ipad</key>
    	<dict>
    		<key>CFBundlePrimaryIcon</key>
    		<dict>
    			<key>CFBundleIconFiles</key>
    			<array>
    				<string>AppIcon20x20.png</string>
    				<string>AppIcon29x29.png</string>
    				<string>AppIcon29x29@2x.png</string>
    				<string>AppIcon40x40@2x.png</string>
    				<string>AppIcon57x57.png</string>
    				<string>AppIcon57x57@2x.png</string>
    				<string>AppIcon60x60.png</string>
    				<string>AppIcon60x60@2x.png</string>
    				<string>AppIcon29x29~ipad.png</string>
    				<string>AppIcon29x29@2x~ipad.png</string>
    				<string>AppIcon40x40~ipad.png</string>
    				<string>AppIcon40x40@2x~ipad.png</string>
    				<string>AppIcon50x50~ipad.png</string>
    				<string>AppIcon50x50@2x~ipad.png</string>
    				<string>AppIcon72x72~ipad.png</string>
    				<string>AppIcon72x72@2x~ipad.png</string>
    				<string>AppIcon76x76~ipad.png</string>
    				<string>AppIcon76x76@2x~ipad.png</string>
    				<string>AppIcon87x87.png</string>
    				<string>AppIcon120x120.png</string>
    				<string>AppIcon167x167.png</string>
    				<string>AppIcon180x180.png</string>
    				<string>AppIconiTunesArtwork.png</string>
    				<string>AppIconiTunesArtwork@2x.png</string>
    			</array>
    		</dict>
    	</dict>
    	<key>CFBundleIdentifier</key>
    	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    	<key>CFBundleName</key>
    	<string>${PRODUCT_NAME}</string>
    	<key>CFBundlePackageType</key>
    	<string>APPL</string>
    	<key>CFBundleShortVersionString</key>
    	<string>$(MARKETING_VERSION)</string>
    	<key>CFBundleSignature</key>
    	<string>${QMAKE_PKGINFO_TYPEINFO}</string>
    	<key>CFBundleVersion</key>
    	<string>$(CURRENT_PROJECT_VERSION)</string>
    	<key>LSRequiresIPhoneOS</key>
    	<true/>
    	<key>MinimumOSVersion</key>
    	<string>${IPHONEOS_DEPLOYMENT_TARGET}</string>
    	<key>NOTE</key>
    	<string>This file was generated by Qt/QMake.</string>
    	<key>UILaunchStoryboardName</key>
    	<string>LaunchScreen</string>
    	<key>UISupportedInterfaceOrientations</key>
    	<array>
    		<string>UIInterfaceOrientationPortrait</string>
    		<string>UIInterfaceOrientationPortraitUpsideDown</string>
    		<string>UIInterfaceOrientationLandscapeLeft</string>
    		<string>UIInterfaceOrientationLandscapeRight</string>
    	</array>
    </dict>
    </plist>
    
    

    I've tried to add all of the required icons to some native XCode projects Assets.xcassets tab and it works fine. Any idea how to make it work on Qt generated XCode project?


  • Moderators

    @Augustas have you added your icon assets in the pro file via QMAKE_ASSET_CATALOGS ?

    e.g:

    QMAKE_ASSET_CATALOGS +=ios/Images.xcassets
    


  • @J-Hilk,
    Yes, I have them added like this:

    ios_icon.files = $$files($$PWD/pictures/iOSAppIcons/AppIcon*.png)
    QMAKE_BUNDLE_DATA += ios_icon
    

    and all of the images seem to be present in my Bundle Data folder in the generated XCode project:

    image


Log in to reply