简体   繁体   中英

In Xcode, how do I use a different AppIcon for each target iOS App?

I have one Xcode project (in Xcode 6.1) with a 4 targets for 4 different apps that share a lot of the same source code.

I'm trying to have each one of them show a different app icon.

Going into Project > General > [select target] > App Icons and Launch Images, I see this:

不同的应用程序图标

But clicking on each AppIcon, I get to the exact same app icons - not the ones that I would like for each project.

Is this just a bug in Xcode? How can I use different app icons for different targets?

  • Click on your already existing xcassets File, where you have defined the Appicons for your first target and add a new Appicon.:

在此输入图像描述

  • You can give the new Appicon a meaningfull name (In my case Appicon-Debug):

在此输入图像描述

  • Go to your targets and select the new target:

在此输入图像描述

  • choose the new AppIcon under General -> "App Icons and Launch Images" -> "App Icons Source":

在此输入图像描述

  • Clean the project and rebuild it.
  1. Go to your app's Assets.xcassets and create a new iOS App Icon by clicking on the + button in the bottom left corner of target's section
  2. Name it AppIcon-Test or Debug or whatever name suits you.
  3. Go to xcassets folder and in the utilities panel allow target membership to both in the File Inspector View. Make sure the all target membership's are enabled for both AppIcon sets.
  4. Select the target for which you want to change icon in the project settings. In "General" Scroll down to App Icons and Launch Images. Select your appicon set for the respective target in App Icons source

转到您应用的Assets.xcassets,然后点击目标部分左下角的+按钮创建一个新的iOS App图标

将其命名为AppIcon-Test或Debug或任何适合您的名称。

转到xcassets文件夹,在实用程序面板中,允许在文件检查器视图中同时使用目标成员身份。确保为两个AppIcon集启用了所有目标成员资格。

在项目设置中选择要更改图标的目标。在“常规”中向下滚动到应用程序图标和启动图像。在应用程序图标源中为相应目标选择您的appicon集

Happy coding :)

I had a similar issue when using multiple targets. Trying to change which asset set is used just didn't work, it would always just auto select the first one in the list. The way I solved this was to rename the AppIcon in each asset set eg AppIconMobile and AppIconTablet .

CLick on the Arrow at right most, which will take you to Xc-assets screen, where you can set images.

Similarly click on other target and set images. If you open your project in finder window, you can notice ProjectName.xcassets where you can see different app icons set. you can copy directly to this folder aswell

I think you just need to create Assets.xcassets for each target

Then create an AppIcon in Asset, no need to give it a different name in each asset

Select the AppIcon on the general section of each target

在此输入图像描述

在此输入图像描述

On top of every other suggestions, you also need to clear Build Folder (top menu Project -> Clean Build Folder), close Xcode, remove app from device / simulator, close simulator, open Xcode and run it again. Otherwise, Xcode will keep cache of your old App Icon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM