xcode 启动图像不更新

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10391559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:09:00  来源:igfitidea点击:

Launch image doesn't update

xcodeimagelaunch

提问by ceriseche

I'm using Xcode 4.3.1. Adding launch image is pretty simple -- just drag the image to the Project->Summary->Launch Images window.

我正在使用 Xcode 4.3.1。添加启动图像非常简单——只需将图像拖到 Project->Summary->Launch Images 窗口即可。

So I set a launch image before and it worked. But when I dragged a different image and run the app on my iPhone again, the launch image still remain the same as the old one. Even after I delete the launch image from the Launch Images window, the old image still shows up upon launching.

所以我之前设置了一个启动图像并且它起作用了。但是当我拖动不同的图像并再次在我的 iPhone 上运行该应用程序时,启动图像仍然与旧图像相同。即使我从 Launch Images 窗口中删除了启动图像,旧图像仍然在启动时显示。

I've tried clearing the build as well. Didn't work.

我也试过清除构建。没用。

Help please. Very much appreciated!

请帮忙。非常感谢!

采纳答案by sch

You should delete the app from the device, then launch it again.

您应该从设备中删除该应用程序,然后再次启动它。

回答by sabiland

I had the same issue, but with launch storyboard. I had to rename the image I've used as a background.

我有同样的问题,但启动故事板。我不得不重命名用作背景的图像。

回答by EliSKoren

Deleting from the device didn't help with Xcode 4.5.1. The build process is caching the image. With a hint from Zorayr's answer to related question "Xcode, can't remove “Launch image” from project," I decided to track the cached image down and destroy it, so it wouldn't keep being built and showing up in my test App.

从设备中删除对 Xcode 4.5.1 没有帮助。构建过程正在缓存图像。根据Zorayr对相关问题“ Xcode,无法从项目中删除“启动图像”的回答中的提示,我决定跟踪缓存的图像并销毁它,这样它就不会继续构建并显示在我的测试应用程序。

Eventually, I found that Xcode (at least 4.5) builds the images by default in the following path off your home directory:

最终,我发现 Xcode(至少 4.5)默认在您的主目录的以下路径中构建图像:

~/Library/Developer/Xcode/DerivedData/<ProjectName>-<uniqueID>/Build/Products/<Scheme>-iphone{os,simulator}/<ProjectName>.app/

~/Library/Developer/Xcode/DerivedData/< ProjectName>-< uniqueID>/Build/Products/< Scheme>-iphone{os,simulator}/< ProjectName>.app/

So in addition toremoving the old App image from the device (or simulator,) you also need to remove the image file(s) from the build cache. But just doing something like

因此,除了从设备(或模拟器)中删除旧的 App 图像之外,您还需要从构建缓存中删除图像文件。但只是做类似的事情

rm ~/Library/Developer/Xcode/DerivedData/MyProject-fpwnjlbayydgzxcdlyrwxrwntapr/Build/Products/Debug-iphoneos/MyProject.app/Default*.png

won't alwayssolve your problem. Instead, you might get a strange error in a popup window saying something like "Signed product moved or deleted." (I can't reproduce it right now to get the exact text.) It doesn't show up in the log file, and it just hangs the build process (in Xcode 4.5.1.) To get around that, I deleted allof the files under the <ProjectName>.app/ directory tree andthe sibling directory tree <ProjectName>.app.dSYM/ containing (seemingly) the symbol tables and signature files for the parallel products. The build process will then re-create everything with no more complaints.

不会总能解决你的问题。相反,您可能会在弹出窗口中看到一个奇怪的错误,比如“已签名的产品已移动或已删除。”(我现在无法复制它以获取确切的文本。)它没有显示在日志文件中,它只是挂起构建过程(在 Xcode 4.5.1 中。)为了解决这个问题,我删除了 < ProjectName>.app/ 目录树兄弟目录树 < ProjectName>.app.dSYM/下的所有文件(表面上)并行产品的符号表和签名文件。构建过程将重新创建所有内容,不再有任何抱怨。

回答by Emil Korngold

What worked for me on iOS 10.2.1, iPhone 5s hardware test device, Xcode 8.2.1

在 iOS 10.2.1、iPhone 5s 硬件测试设备、Xcode 8.2.1 上对我有用

I think it has nothing to do with Xcode. The test device appears to be caching the LaunchScreen.storyboard image. I needed to reboot my device by holding home + top button. Then I rebuilt, low and behold, the image updated.

我认为这与 Xcode 无关。测试设备似乎正在缓存 LaunchScreen.storyboard 图像。我需要通过按住主页 + 顶部按钮重新启动我的设备。然后我重建,低,看,图像更新。

回答by Ishaan Gupta

Quit the simulator and then run the project again. For device, as mentioned in other answers, delete the app from the device and then run the app again.

退出模拟器,然后再次运行项目。对于设备,如其他答案中所述,从设备中删除该应用程序,然后再次运行该应用程序。

回答by olynoise

If you were using an asset catalog, it can also help to delete the images from the Images.xcassets file, and then load them manually in General>Launch Images.

如果您使用的是资产目录,它也有助于从 Images.xcassets 文件中删除图像,然后在 General>Launch Images 中手动加载它们。

回答by Hassan Aftab

This is what worked for me

这对我有用

  1. Put the new image in project folder
  2. Run app on device/simulator
  3. Put image in xcassets under a different name
  4. Run app again and it works
  1. 将新图像放在项目文件夹中
  2. 在设备/模拟器上运行应用程序
  3. 将图像以不同的名称放入 xcassets
  4. 再次运行应用程序,它可以工作

回答by thomsky

I thought I would create an update for anyone who is XCode 10 (and possibly XCode 9) and experiencing a blank black or white screen after modifying a launch image. In my case I had to create launch images for the iPhone XR, iPhone X, iPhone XS and iPhone XS Max.

我想我会为 XCode 10(也可能是 XCode 9)并且在修改启动图像后遇到空白的黑屏或白屏的任何人创建更新。就我而言,我必须为 iPhone XR、iPhone X、iPhone XS 和 iPhone XS Max 创建启动图像。

Originally I just had a sample white launch image for testing. After creating my proper image for the XR and replacing the sample the change would simply never show (on the XR device). I would still get a white screen.

最初我只有一个示例白色启动图像用于测试。在为 XR 创建合适的图像并替换样本后,更改将永远不会显示(在 XR 设备上)。我仍然会得到一个白屏。

I tried all of these in combination and failed: -deleting the app beforehand. -deleting xcode derived data and cleaning the build. -restart Xcode and the device and the computer. -deleting any existence of the white launch image on the computer. -manually editing the JSON in a new images asset with the correct file names

我尝试了所有这些组合但失败了: - 事先删除应用程序。- 删除 xcode 派生数据并清理构建。- 重新启动 Xcode 和设备和计算机。- 删除计算机上任何存在的白色启动图像。- 使用正确的文件名手动编辑新图像资产中的 JSON

The XR device would continuously show a white screen and after meddling with the build setting and migrating back to image packs it turned to black.

XR 设备会持续显示白屏,在干预构建设置并迁移回图像包后,它会变成黑色。

Solution: Ultimately it started working after I also replaced the white 'XS' launch image with a new one as well. Even though the device is an XR. This is an odd solution but solutions like this have helped with launch images throughout the years.

解决方案:最终它在我也用新的替换白色的“XS”启动图像后开始工作。即使该设备是 XR。这是一个奇怪的解决方案,但像这样的解决方案多年来一直帮助发布图像。

回答by afp

Steps that worked for me in 2020 (xCode Version 11.4.1):

2020 年对我有用的步骤(xCode 版本 11.4.1):

  • Delete derived data
  • Restart xCode
  • Delete app on device
  • Restart device
  • Clean rebuild and run
  • 删除派生数据
  • 重启 xCode
  • 删除设备上的应用
  • 重启设备
  • 干净重建并运行

Except the last step, I think the order doesn't matter. It's really annoying though and I'm not even sure if it always works. Pretty pathetic on apple's side. Good luck guys!

除了最后一步,我认为顺序无关紧要。不过这真的很烦人,我什至不确定它是否总是有效。苹果方面相当可悲。祝大家好运!

回答by S. Prescott

For me, quitting the Simulator and restarting it worked -- I can finally see the updated launch image. The note above from Emil Korngold triggered me to try this.

对我来说,退出模拟器并重新启动它是有效的——我终于可以看到更新的启动图像了。上面来自 Emil Korngold 的注释促使我尝试这样做。