在El Capitan上使用xcode6.4构建的应用程序中,优胜美地上的图像资源(xcassets)无法正确显示 [英] Image resources (xcassets) not displayed correctly on Yosemite in application built on El Capitan using xcode6.4

查看:136
本文介绍了在El Capitan上使用xcode6.4构建的应用程序中,优胜美地上的图像资源(xcassets)无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Xcode6.4在El Capitan上构建我的应用程序时(现在Xcode7不再可用),所有图像/图标(AppIcon除外)都不会显示或显示为乱码.

When I build my application on El Capitan using Xcode6.4 (Xcode7 is no option right now), all images/icons (except the AppIcon) does not show, or looks garbled.

看着资产编译器的输出看起来不错,但是我怀疑有两个输出可能是相关的,但是我不确定:

Looking at the output from the asset compiler it looks fine, but there are two outputs I suspect could be related, but I am far from certain:

2015-10-02 12:26:53.569 ibtoold [28899:273288] NSFileCoordinator无所作为.

2015-10-02 12:26:53.569 ibtoold[28899:273288] NSFileCoordinator is doing nothing.

2015-10-02 12:26:54.906 ibtoold [28899:276436] CoreUI(DEBUG):CSIGenerator使用"LZFSE"压缩coreui版本(362.000000)

2015-10-02 12:26:54.906 ibtoold[28899:276436] CoreUI(DEBUG): CSIGenerator using 'LZFSE' Compression coreui version (362.000000)

难道是LZFSE压缩搞乱了,导致优胜美地无法正确解压缩吗?如果是,是否有办法覆盖它?

Could it be that the LZFSE compression messes up so that Yosemite is unable to decompress correctly, and if so, is there a way to override this?

在El Capitan上运行该应用程序没有问题.

There is no problem when the application is run on El Capitan.

任何建议都非常欢迎.

更新: 当应用程序在优胜美地上运行时,这些消息将输出到控制台:

UPDATE: These messages are output to console when the app runs on Yosemite:

02.10.15 22.31.59,914 AppName [452]:-[CUIThemeRendition newImageFromCSIDataSlice:ofBitmap:usingColorspace:] CSI中不受支持的像素格式得到了36864

02.10.15 22.31.59,914 AppName[452]: -[CUIThemeRendition newImageFromCSIDataSlice:ofBitmap: usingColorspace:] Unsupported pixel format in CSI got 36864

02.10.15 22.31.59,914 AppName [452]:无法从csi位图数据创建未切片的图像.

02.10.15 22.31.59,914 AppName[452]: Unable to create unsliced image from csi bitmap data.

似乎他们在Xcode beta 3中的iOS7上遇到了这个问题

It seems they had this problem for iOS7 in Xcode beta 3 here

但是奇怪的是它突然又出现了,我的目标是OS X.

But it seems strange it suddenly appeared again now, and my target is OS X.

更新: 所以我已经升级到Xcode7,整个问题消失了.现在,所有图片和图标都可以在El Capitan和优胜美地中正确显示.

UPDATE: So I have upgraded to Xcode7, and the whole problem disappeared. All images and Icons now show correctly in El Capitan and Yosemite.

推荐答案

背景信息:

每个版本的Xcode都内置了一个模拟器. Xcode 6.4具有iOS模拟器8.4. Xcode 7.1具有iOS Simulator 9.1等.这些模拟器的配置文件存储在Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/Runtimes

Each version of Xcode comes with a simulator built into it. Xcode 6.4 has iOS Simulator 8.4. Xcode 7.1 has iOS Simulator 9.1 etc. These simulators have profiles stored in Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/Runtimes

当您安装其他模拟器时,它们会在Xcode版本之间共享,并且它们的配置文件存储在/Library/Developer/CoreSimulator/Profiles/Runtimes

When you install additional simulators, these get shared across Xcode versions, and their profiles are stored at /Library/Developer/CoreSimulator/Profiles/Runtimes

因此,当您从Xcode 7.1安装iOS Simulator 9.0时,9.0模拟器配置文件将置于共享位置.如果您从Xcode 7.1安装iOS Simulator 8.4,它也会放到这里,因为Xcode 7.1不知道Xcode 6.4内隐藏了iOS Simulator 8.4的副本.

So when you install iOS Simulator 9.0 from Xcode 7.1, the 9.0 simulator profile gets put in the shared location. If you install iOS Simulator 8.4 from Xcode 7.1, it will get put here as well, as Xcode 7.1 is unaware that there is a copy of the iOS Simulator 8.4 hidden inside of Xcode 6.4.

所以似乎正在发生(对于Xcode 6.4):

So what appears to be happening is (for Xcode 6.4):

  • 当您调用actool创建资产目录时,它将启动ibtoold
  • ibtoold通过XPC服务(com.apple.coresimulator)进行调用,并在模拟器服务之上运行IBCocoaTouchImageCatalogTool的实例
  • IBCocoaTouchImageCatalogTool在/Library/Developer/CoreSimulator/Profiles/Runtimes处经历了所有模拟器运行时,并且显然使用了它可以找到的最新模拟器.为什么这样做对我来说还不是很清楚,但是没有多少旋钮摆弄可以使它做任何其他事情.
  • when you call actool to create an asset catalogs, it launches ibtoold
  • ibtoold calls through an XPC service (com.apple.coresimulator) and runs an instance of IBCocoaTouchImageCatalogTool on top of the simulator service
  • IBCocoaTouchImageCatalogTool goes through all of the simulator runtimes at /Library/Developer/CoreSimulator/Profiles/Runtimes and apparently uses the latest one it can find. Why it does this is not really clear to me, but no amount of knob fiddling caused it to do anything else.

因此,如果您已安装Xcode 7.1.1,并下载9.0模拟器,则将中断Xcode 6.4的安装,因为9.0模拟器将其运行时安装在共享模拟器运行时区域中,而Xcode 6.4会选择它并在某些环境中使用它案件.显然,这会导致actool破坏其要导入的所有png.在我的实验中,可以很好地导入jpg.其他有趣的副作用包括以下事实:尝试在Xcode 6.4中编辑Storyboard会导致Xcode 6.4崩溃.

So if you have Xcode 7.1.1 installed, and download the 9.0 simulator you will break your Xcode 6.4 install because the 9.0 simulator installs its runtime in the shared simulator runtime area, and Xcode 6.4 picks it up and uses it in some cases. This apparently causes actool to mangle any pngs that it is importing. In my experimentation it is fine importing jpgs. Other fun side effects include the fact that attempting to edit Storyboards in Xcode 6.4 causes Xcode 6.4 to crash.

因此,如果您同时需要Xcode 7.x和Xcode 6.4,请不要从Xcode 7安装中安装任何iOS 9.x模拟器.

So if you need to have both Xcode 7.x and Xcode 6.4 do NOT install any iOS 9.x simulators from the Xcode 7 installs.

这篇关于在El Capitan上使用xcode6.4构建的应用程序中,优胜美地上的图像资源(xcassets)无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆