I have added the icon as shown in the pic below but I am still not seeing the icon in my device or simulator.
我已经添加了如下图所示的图标,但我仍然没有看到我的设备或模拟器中的图标。
15 个解决方案
#1
34
This might be an XCode 5 bug that the added icons are not actually included in the app bundle, but you can work around it by going to Build Phases, expand Copy Bundle Resources, then press the "+" sign in the bottom to manually add the icon files to this category.
这可能是一个XCode 5错误,添加的图标实际上并未包含在应用程序包中,但您可以通过转到Build Phases,展开Copy Bundle Resources,然后按下底部的“+”符号来手动添加它图标文件到此类别。
In addition iOS 5/6 seems to have a bug that the screen doesn't update the app icon even if the icon files are included in the bundle. To work around it (as suggested by josema.vitaminew at App Icon not changing when app version is updated in iOS 5 simulator) you can drag the app icon into a folder, then iOS will update the appearance of it.
此外,iOS 5/6似乎有一个错误,即即使图标文件包含在捆绑包中,屏幕也不会更新应用程序图标。要解决它(在iOS图形模拟器中更新应用程序版本时,应用程序图标上的josema.vitaminew建议不要更改)您可以将应用程序图标拖到文件夹中,然后iOS将更新它的外观。
#2
24
If using the Asset Catalog, it might be worth also checking whether Images.xcassets
holds all your targets as shown in the below image.
如果使用资产目录,则可能还需要检查Images.xcassets是否包含所有目标,如下图所示。
#3
13
Expanding on adp's answer, if anyone has switched to asset catalogs but they stopped working, and still can't find a solution for Asset Catalog, Images.xcassets, AppIcon or LaunchImage not working, here is a reproduction of the same problem I encountered, and the solution:
扩展adp的答案,如果有人切换到资产目录但他们停止工作,仍然找不到资产目录,Images.xcassets,AppIcon或LaunchImage无法解决的解决方案,这里是我遇到的同样问题的再现,和解决方案:
I had upgraded to Xcode 6 and opened a project created by an earlier version (4 or 5, not sure) and no matter what I did, AppIcons and LaunchImages absolutely would show up when I ran the app in either iOS Simulator or the device.
我已升级到Xcode 6并打开了由早期版本(4或5,不确定)创建的项目,无论我做了什么,当我在iOS模拟器或设备中运行应用程序时,AppIcons和LaunchImages绝对会出现。
-
I tried Xcode->Product->Clean, Xcode->Window->Organizer->Projects->Derived Data->Delete..., relaunching Xcode and the iOS Simulator, then rebuilding and relaunching the app (failed).
我尝试了Xcode-> Product-> Clean,Xcode-> Window-> Organizer-> Projects-> Derived Data-> Delete ...,重新启动Xcode和iOS模拟器,然后重建和重新启动应用程序(失败)。
-
I tried "Reset Contents and Settings..." in iOS Simulator and even deleting ~/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphoneos and relaunching the app (failed).
我尝试在iOS模拟器中“重置内容和设置...”,甚至删除〜/ Library / Developer / Xcode / DerivedData // Build / Products / Debug-iphoneos并重新启动应用程序(失败)。
-
I tried archiving the project, hoping that it was just an issue with the iOS Simulator, but the icon in the Organizer-Archives window was still shown as the default white square with lines, confirming that the icon would also not show on a device (a helpful trick to have when no device is handy). (failed).
我尝试归档该项目,希望它只是iOS模拟器的一个问题,但是Organizer-Archives窗口中的图标仍然显示为带有线条的默认白色方块,确认图标也不会显示在设备上(当没有设备方便时,有一个有用的技巧)。 (失败)。
-
I tried choosing "Don't use asset catalogs" in Target Settings and creating a new AppIcon-2 and LaunchImage-2 (failed). -this is what cost me at least 2 more hours, because this should have worked and the fact that it didn't revealed the bug in Xcode but I just couldn't see it-
我尝试在目标设置中选择“不使用资产目录”并创建新的AppIcon-2和LaunchImage-2(失败)。 - 这至少花了我2个小时,因为这应该有效,而且事实上它没有透露Xcode中的错误,但我只是看不到它 -
-
I tried creating a new project from the single view template and compared all of the Info.plist settings (failed).
我尝试从单一视图模板创建一个新项目,并比较所有Info.plist设置(失败)。
-
I tried comparing the new project's Contents.json with mine in Images.xcassets (failed).
我尝试将新项目的Contents.json与我的Images.xcassets(失败)进行比较。
-
I tried dragging the images from the left sidebar Navigator into the AppIcon image wells, hoping that they were just not being copied in a build phase for some reason (failed).
我尝试将左侧边栏导航器中的图像拖动到AppIcon图像井中,希望它们不会因为某些原因(失败)而在构建阶段被复制。
-
Finally in exasperation at the thought of having to create a new project just to fix the icons, I tried deleting Images.xcassets in the left sidebar Navigator and choosing "Move to Trash", then quitting Xcode and relaunching in case it cached anything. Then when I went to click the App Icons Source popup menu, it only showed "Don't use asset catalogs". I had to select it in order to bring back the "Use Asset Catalog" button. Then I was able to create new AppIcons and LaunchImages, drag images to the wells, build and launch the app in iOS Simulator and finally see icons appear properly.
最后我想到必须创建一个新项目才能修复图标,我试着删除左侧边栏导航器中的Images.xcassets并选择“Move to Trash”,然后退出Xcode并重新启动以防万一缓存。然后当我点击App Icons Source弹出菜单时,它只显示“不要使用资产目录”。我必须选择它才能恢复“使用资产目录”按钮。然后我能够创建新的AppIcons和LaunchImages,将图像拖到井中,在iOS模拟器中构建和启动应用程序,最后看到图标正确显示。
So the problem appears to be with how Xcode stores Images.xcassets inside the project, and not with target membership, derived data, or anything in Images.xcassets itself. You must remove your assets file and create a fresh one, then drag images to wells by hand again.
所以问题似乎在于Xcode如何将Images.xcassets存储在项目中,而不是目标成员资格,派生数据或Images.xcassets本身中的任何内容。您必须删除资产文件并创建一个新文件,然后再手动将图像拖到井中。
It took me 3 hours of research to solve something that should have "just worked" and the entire process of having to manually create individually sized art assets has been so tedious over the years that it has personally cost me countless hours of busywork.
我花了3个小时的研究来解决应该“正常工作”的事情,而且这些年来人工花费了无数小时的繁忙工作,整个过程中必须手动创建个别大小的艺术资产这么繁琐。
Hopefully this bug workaround helps someone avoid the frustration I went through. I can't help with the friction of manually sizing art assets, but I highly recommend the Icon Slayer website to automate that (of which I have no affiliation).
希望这个bug解决方法可以帮助别人避免我经历的挫败感。我无法帮助手动调整艺术资产的摩擦力,但我强烈推荐Icon Slayer网站自动化(我没有隶属关系)。
#4
7
I have encountered the same problem when the project is switching from xcode5 to xcode6 . The solution is just click on the icon in the image asset,open the right panel , just tick the iOS version option in the panel,add the icons that are blank run it again ... It worked for me
当项目从xcode5切换到xcode6时,我遇到了同样的问题。解决方案只需单击图像资源中的图标,打开右侧面板,只需勾选面板中的iOS版本选项,添加空白图标再次运行...它对我有用
#5
3
I want to add my solution, where the problem is only isolated to the iPad, my app icon will not show only for iPads. After trying all the solution above, and I looked in the info.plist and found this flag that was not there before the problem with iPads. A new key/value has been added called "CFBundleIcons~ipad" without my knowledge and had nothing as it's value. Removing the key helped resolve my issue.
我想添加我的解决方案,问题只是隔离到iPad,我的应用程序图标不会只显示在iPad上。在尝试了上面的所有解决方案后,我查看了info.plist,发现这个标志在iPad出现问题之前不存在。在我不知情的情况下添加了一个名为“CFBundleIcons~ipad”的新键/值,并没有任何价值。删除密钥有助于解决我的问题。
#6
2
According to Apple Docs, the icons must be placed on the root level of the app files.
根据Apple Docs,图标必须放在应用程序文件的根级别。
IOS/Xcode will not go under directories to search your image.
IOS / Xcode不会在目录下搜索您的图像。
Solution is to move the images onto the root of your application i.e. where your source files are, or you can create references in the same way.
解决方案是将图像移动到应用程序的根目录,即源文件所在的位置,或者您可以以相同的方式创建引用。
Regards Heider
#7
1
I had the same problem and after a couple of hours finally I could resolved it, copying an old -info.plist from one of my backups project and replace it, this works fine for me. Regards
我有同样的问题,经过几个小时后我终于解决了,从我的一个备份项目复制旧的-info.plist并替换它,这对我来说很好。问候
#8
1
My issue ended up being I had used jpg images, rather than pngs.
我的问题最终是我使用了jpg图像,而不是pngs。
#9
0
For me, it was a much simpler solution than the others listed here. I had simply got the assets the wrong size. I had not paid attention to the multipliers that are necessary (e.g. 2x or 3x) and therefore the build was generating a warning for the incorrect asset sizes (which I had ignored). In my case, I corrected the image sizes and voila they appeared in the simulator.
对我来说,这是一个比这里列出的其他解决方案简单得多的解决方案。我只是把资产的大小弄错了。我没有注意到必要的乘数(例如2x或3x),因此构建正在为不正确的资产规模(我忽略了)产生警告。在我的情况下,我纠正了它们出现在模拟器中的图像大小和瞧。
#10
0
For a macOS/OSX application, you also need to always add a 128 pixel size (and 2x), you can not only use a 512 pixel size and expect it to size down.
对于macOS / OSX应用程序,您还需要始终添加128像素大小(和2x),您不仅可以使用512像素大小并期望它缩小尺寸。
#11
0
If your app icon has any transparency then it won't work. Check it!
如果您的应用图标具有任何透明度,那么它将无效。核实!
#12
0
I had all the images in the relevant folders and when I right clicked on the empty icon image in Images.xcassets/AppIcon
and chose show in finder
it would find the image correctly and show it, but for whatever reason it wasn't adding correctly to the project.
我有相关文件夹中的所有图像,当我右键单击Images.xcassets / AppIcon中的空图标图像并选择在查找器中显示时,它会正确找到图像并显示它,但无论出于何种原因它都没有正确添加到项目。
After trying a lot of different things above I simply dragged the images from finder into the AppIcon area and it worked.
在尝试了很多不同的事情后,我只是将图像从finder拖到AppIcon区域,然后就可以了。
#13
0
If you are using cocoapods be sure to check this answer from a related question. After many lost hours, this is what fixed it for me.
如果您正在使用cocoapods,请务必从相关问题中查看此答案。经过许多时间的浪费,这就是为我解决的问题。
#14
0
In my case, I just needed to clean and rebuild my project.
就我而言,我只需要清理并重建我的项目。
#15
0
Xcode 9.3:
- Open your project and add AppIcon images.
-
Click on general, go to "App Icon and Launch Image"
点击常规,转到“App Icon并启动图像”
-
Click "App Icon resource" and add AppIcon (In my case it added AppIcon-1, so you can use that on rename that and do above step again).
单击“应用程序图标资源”并添加AppIcon(在我的情况下,它添加了AppIcon-1,因此您可以在重命名时使用它并再次执行上述步骤)。
打开项目并添加AppIcon图像。
#1
34
This might be an XCode 5 bug that the added icons are not actually included in the app bundle, but you can work around it by going to Build Phases, expand Copy Bundle Resources, then press the "+" sign in the bottom to manually add the icon files to this category.
这可能是一个XCode 5错误,添加的图标实际上并未包含在应用程序包中,但您可以通过转到Build Phases,展开Copy Bundle Resources,然后按下底部的“+”符号来手动添加它图标文件到此类别。
In addition iOS 5/6 seems to have a bug that the screen doesn't update the app icon even if the icon files are included in the bundle. To work around it (as suggested by josema.vitaminew at App Icon not changing when app version is updated in iOS 5 simulator) you can drag the app icon into a folder, then iOS will update the appearance of it.
此外,iOS 5/6似乎有一个错误,即即使图标文件包含在捆绑包中,屏幕也不会更新应用程序图标。要解决它(在iOS图形模拟器中更新应用程序版本时,应用程序图标上的josema.vitaminew建议不要更改)您可以将应用程序图标拖到文件夹中,然后iOS将更新它的外观。
#2
24
If using the Asset Catalog, it might be worth also checking whether Images.xcassets
holds all your targets as shown in the below image.
如果使用资产目录,则可能还需要检查Images.xcassets是否包含所有目标,如下图所示。
#3
13
Expanding on adp's answer, if anyone has switched to asset catalogs but they stopped working, and still can't find a solution for Asset Catalog, Images.xcassets, AppIcon or LaunchImage not working, here is a reproduction of the same problem I encountered, and the solution:
扩展adp的答案,如果有人切换到资产目录但他们停止工作,仍然找不到资产目录,Images.xcassets,AppIcon或LaunchImage无法解决的解决方案,这里是我遇到的同样问题的再现,和解决方案:
I had upgraded to Xcode 6 and opened a project created by an earlier version (4 or 5, not sure) and no matter what I did, AppIcons and LaunchImages absolutely would show up when I ran the app in either iOS Simulator or the device.
我已升级到Xcode 6并打开了由早期版本(4或5,不确定)创建的项目,无论我做了什么,当我在iOS模拟器或设备中运行应用程序时,AppIcons和LaunchImages绝对会出现。
-
I tried Xcode->Product->Clean, Xcode->Window->Organizer->Projects->Derived Data->Delete..., relaunching Xcode and the iOS Simulator, then rebuilding and relaunching the app (failed).
我尝试了Xcode-> Product-> Clean,Xcode-> Window-> Organizer-> Projects-> Derived Data-> Delete ...,重新启动Xcode和iOS模拟器,然后重建和重新启动应用程序(失败)。
-
I tried "Reset Contents and Settings..." in iOS Simulator and even deleting ~/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphoneos and relaunching the app (failed).
我尝试在iOS模拟器中“重置内容和设置...”,甚至删除〜/ Library / Developer / Xcode / DerivedData // Build / Products / Debug-iphoneos并重新启动应用程序(失败)。
-
I tried archiving the project, hoping that it was just an issue with the iOS Simulator, but the icon in the Organizer-Archives window was still shown as the default white square with lines, confirming that the icon would also not show on a device (a helpful trick to have when no device is handy). (failed).
我尝试归档该项目,希望它只是iOS模拟器的一个问题,但是Organizer-Archives窗口中的图标仍然显示为带有线条的默认白色方块,确认图标也不会显示在设备上(当没有设备方便时,有一个有用的技巧)。 (失败)。
-
I tried choosing "Don't use asset catalogs" in Target Settings and creating a new AppIcon-2 and LaunchImage-2 (failed). -this is what cost me at least 2 more hours, because this should have worked and the fact that it didn't revealed the bug in Xcode but I just couldn't see it-
我尝试在目标设置中选择“不使用资产目录”并创建新的AppIcon-2和LaunchImage-2(失败)。 - 这至少花了我2个小时,因为这应该有效,而且事实上它没有透露Xcode中的错误,但我只是看不到它 -
-
I tried creating a new project from the single view template and compared all of the Info.plist settings (failed).
我尝试从单一视图模板创建一个新项目,并比较所有Info.plist设置(失败)。
-
I tried comparing the new project's Contents.json with mine in Images.xcassets (failed).
我尝试将新项目的Contents.json与我的Images.xcassets(失败)进行比较。
-
I tried dragging the images from the left sidebar Navigator into the AppIcon image wells, hoping that they were just not being copied in a build phase for some reason (failed).
我尝试将左侧边栏导航器中的图像拖动到AppIcon图像井中,希望它们不会因为某些原因(失败)而在构建阶段被复制。
-
Finally in exasperation at the thought of having to create a new project just to fix the icons, I tried deleting Images.xcassets in the left sidebar Navigator and choosing "Move to Trash", then quitting Xcode and relaunching in case it cached anything. Then when I went to click the App Icons Source popup menu, it only showed "Don't use asset catalogs". I had to select it in order to bring back the "Use Asset Catalog" button. Then I was able to create new AppIcons and LaunchImages, drag images to the wells, build and launch the app in iOS Simulator and finally see icons appear properly.
最后我想到必须创建一个新项目才能修复图标,我试着删除左侧边栏导航器中的Images.xcassets并选择“Move to Trash”,然后退出Xcode并重新启动以防万一缓存。然后当我点击App Icons Source弹出菜单时,它只显示“不要使用资产目录”。我必须选择它才能恢复“使用资产目录”按钮。然后我能够创建新的AppIcons和LaunchImages,将图像拖到井中,在iOS模拟器中构建和启动应用程序,最后看到图标正确显示。
So the problem appears to be with how Xcode stores Images.xcassets inside the project, and not with target membership, derived data, or anything in Images.xcassets itself. You must remove your assets file and create a fresh one, then drag images to wells by hand again.
所以问题似乎在于Xcode如何将Images.xcassets存储在项目中,而不是目标成员资格,派生数据或Images.xcassets本身中的任何内容。您必须删除资产文件并创建一个新文件,然后再手动将图像拖到井中。
It took me 3 hours of research to solve something that should have "just worked" and the entire process of having to manually create individually sized art assets has been so tedious over the years that it has personally cost me countless hours of busywork.
我花了3个小时的研究来解决应该“正常工作”的事情,而且这些年来人工花费了无数小时的繁忙工作,整个过程中必须手动创建个别大小的艺术资产这么繁琐。
Hopefully this bug workaround helps someone avoid the frustration I went through. I can't help with the friction of manually sizing art assets, but I highly recommend the Icon Slayer website to automate that (of which I have no affiliation).
希望这个bug解决方法可以帮助别人避免我经历的挫败感。我无法帮助手动调整艺术资产的摩擦力,但我强烈推荐Icon Slayer网站自动化(我没有隶属关系)。
#4
7
I have encountered the same problem when the project is switching from xcode5 to xcode6 . The solution is just click on the icon in the image asset,open the right panel , just tick the iOS version option in the panel,add the icons that are blank run it again ... It worked for me
当项目从xcode5切换到xcode6时,我遇到了同样的问题。解决方案只需单击图像资源中的图标,打开右侧面板,只需勾选面板中的iOS版本选项,添加空白图标再次运行...它对我有用
#5
3
I want to add my solution, where the problem is only isolated to the iPad, my app icon will not show only for iPads. After trying all the solution above, and I looked in the info.plist and found this flag that was not there before the problem with iPads. A new key/value has been added called "CFBundleIcons~ipad" without my knowledge and had nothing as it's value. Removing the key helped resolve my issue.
我想添加我的解决方案,问题只是隔离到iPad,我的应用程序图标不会只显示在iPad上。在尝试了上面的所有解决方案后,我查看了info.plist,发现这个标志在iPad出现问题之前不存在。在我不知情的情况下添加了一个名为“CFBundleIcons~ipad”的新键/值,并没有任何价值。删除密钥有助于解决我的问题。
#6
2
According to Apple Docs, the icons must be placed on the root level of the app files.
根据Apple Docs,图标必须放在应用程序文件的根级别。
IOS/Xcode will not go under directories to search your image.
IOS / Xcode不会在目录下搜索您的图像。
Solution is to move the images onto the root of your application i.e. where your source files are, or you can create references in the same way.
解决方案是将图像移动到应用程序的根目录,即源文件所在的位置,或者您可以以相同的方式创建引用。
Regards Heider
#7
1
I had the same problem and after a couple of hours finally I could resolved it, copying an old -info.plist from one of my backups project and replace it, this works fine for me. Regards
我有同样的问题,经过几个小时后我终于解决了,从我的一个备份项目复制旧的-info.plist并替换它,这对我来说很好。问候
#8
1
My issue ended up being I had used jpg images, rather than pngs.
我的问题最终是我使用了jpg图像,而不是pngs。
#9
0
For me, it was a much simpler solution than the others listed here. I had simply got the assets the wrong size. I had not paid attention to the multipliers that are necessary (e.g. 2x or 3x) and therefore the build was generating a warning for the incorrect asset sizes (which I had ignored). In my case, I corrected the image sizes and voila they appeared in the simulator.
对我来说,这是一个比这里列出的其他解决方案简单得多的解决方案。我只是把资产的大小弄错了。我没有注意到必要的乘数(例如2x或3x),因此构建正在为不正确的资产规模(我忽略了)产生警告。在我的情况下,我纠正了它们出现在模拟器中的图像大小和瞧。
#10
0
For a macOS/OSX application, you also need to always add a 128 pixel size (and 2x), you can not only use a 512 pixel size and expect it to size down.
对于macOS / OSX应用程序,您还需要始终添加128像素大小(和2x),您不仅可以使用512像素大小并期望它缩小尺寸。
#11
0
If your app icon has any transparency then it won't work. Check it!
如果您的应用图标具有任何透明度,那么它将无效。核实!
#12
0
I had all the images in the relevant folders and when I right clicked on the empty icon image in Images.xcassets/AppIcon
and chose show in finder
it would find the image correctly and show it, but for whatever reason it wasn't adding correctly to the project.
我有相关文件夹中的所有图像,当我右键单击Images.xcassets / AppIcon中的空图标图像并选择在查找器中显示时,它会正确找到图像并显示它,但无论出于何种原因它都没有正确添加到项目。
After trying a lot of different things above I simply dragged the images from finder into the AppIcon area and it worked.
在尝试了很多不同的事情后,我只是将图像从finder拖到AppIcon区域,然后就可以了。
#13
0
If you are using cocoapods be sure to check this answer from a related question. After many lost hours, this is what fixed it for me.
如果您正在使用cocoapods,请务必从相关问题中查看此答案。经过许多时间的浪费,这就是为我解决的问题。
#14
0
In my case, I just needed to clean and rebuild my project.
就我而言,我只需要清理并重建我的项目。
#15
0
Xcode 9.3:
- Open your project and add AppIcon images.
-
Click on general, go to "App Icon and Launch Image"
点击常规,转到“App Icon并启动图像”
-
Click "App Icon resource" and add AppIcon (In my case it added AppIcon-1, so you can use that on rename that and do above step again).
单击“应用程序图标资源”并添加AppIcon(在我的情况下,它添加了AppIcon-1,因此您可以在重命名时使用它并再次执行上述步骤)。
打开项目并添加AppIcon图像。