在 iOS 中分析 Assets.car 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22630418/
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
Analysing Assets.car file in iOS
提问by Rajeev
I have trying to reduce the overall size of my iOS application which is currently 48MB. When I analyze sub folders, I found Assets.car is taking 41MB. I am not able to open and see which one is taking that much space.
我试图减少目前为 48MB 的 iOS 应用程序的整体大小。当我分析子文件夹时,我发现 Assets.car 占用了 41MB。我无法打开并查看哪个占用了那么多空间。
I couldn't find any good documentation regarding Assets.car file. Can someone suggest how to view the contents?
我找不到关于 Assets.car 文件的任何好的文档。有人可以建议如何查看内容吗?
回答by lewis
This tool can extract a .car archive: https://github.com/steventroughtonsmith/cartool
此工具可以提取 .car 档案:https: //github.com/steventroughtonsmith/cartool
Steps to extract archive:
提取存档的步骤:
Once you've downloaded the zip from github, compile it in Xcode to generate the command line tool. Then expand the Products
group and right click on the cartool
file and locate it in finder. You can then run the tool like so:
从 github 下载 zip 后,在 Xcode 中编译它以生成命令行工具。然后展开Products
组并右键单击该cartool
文件并在查找器中找到它。然后,您可以像这样运行该工具:
- open terminal
cd /path/to/cartool
./cartool /path/to/Assets.car /path/to/outputDirectory
- 打开终端
cd /path/to/cartool
./cartool /path/to/Assets.car /path/to/outputDirectory
回答by Jano
Run Apple's assetutil:
运行苹果的资产工具:
xcrun --sdk iphoneos assetutil --info Assets.car
you'll get a JSON description of each item in the file. Something like this:
您将获得文件中每个项目的 JSON 描述。像这样的东西:
{
"Height" : 60,
"Scale" : 1,
"RenditionName" : "D3801CE9-19F1-4CE9-97C6-7E1EFFFCAE89",
"AssetType" : "Vector",
"SizeOnDisk" : 10822,
"Name" : "mailbox",
"Idiom" : "universal",
"Width" : 99
},
Note the line "SizeOnDisk" : 10822
.
注意行"SizeOnDisk" : 10822
。
This tool performs limited .car manipulation, run man assetutil
for details.
此工具执行有限的 .car 操作,请运行man assetutil
以了解详细信息。
The Assets.car seems to be a proprietary Apple's archive that first appeared in iOS 7. A few utilities are able to extract its contents using the private class CUICatalog
of the CoreUI framework:
Assets.car 似乎是首次出现在 iOS 7 中的 Apple 专有档案。一些实用程序能够使用CUICatalog
CoreUI 框架的私有类提取其内容:
There is also an app that reads .car files: crunch9$, 15 day trial
还有一个读取.car文件的应用:crunch9$,15天试用
Running strings Assets.car
returned
跑strings Assets.car
回来了
@(#)PROGRAM:CoreUI PROJECT:CoreUI-475.1.1
IBCocoaTouchImageCatalogTool-9.0
Running find
inside Xcode-beta returned /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBCocoaTouchImageCatalogTool
, which is a simulator executable (i386 + x86_64). Didn't investigate any further but I bet that this tool could open .car archives if you run it inside the simulator.
find
在 Xcode-beta 中运行返回/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBCocoaTouchImageCatalogTool
,这是一个模拟器可执行文件 (i386 + x86_64)。没有进一步调查,但我敢打赌,如果您在模拟器中运行该工具,它可以打开 .car 档案。
回答by Guilherme Rambo
If you want to browse and extract asset catalogs, you can also use my app Asset Catalog Tinkerer
如果你想浏览和提取资产目录,你也可以使用我的应用资产目录 Tinkerer
回答by J.Caspar
Guilherme Rambo said is correct, not the Lewis42.
Guilherme Rambo说的没错,不是Lewis42。
Suppose a pdf file('a.pdf') in Asserts.car.
假设 Asserts.car 中有一个 pdf 文件('a.pdf')。
You will get three png files(a.png/[email protected]/[email protected]) if using cartool, file format had been changed.
如果使用cartool,您将获得三个png文件(a.png/[email protected]/[email protected]),文件格式已更改。
But, if you using AssetCatalogTinkerer, you can preview the a.pdf file(no file format changed).
但是,如果您使用 AssetCatalogTinkerer,您可以预览 a.pdf 文件(未更改文件格式)。
回答by yoAlex5
You can try an online tool, or a QLCARFiles QuickLook pluginfor Mac
您可以尝试使用在线工具或适用于 Mac的QLCARFiles QuickLook 插件
回答by RhodanV5500
Universal-binaries seem to contain multiple image resolutions for each screen-density.
通用二进制文件似乎包含每个屏幕密度的多个图像分辨率。
Once the app is uploaded to the App Store the file-size will be less than your universal-binary, because each device will only get appropriate image densities.
应用程序上传到 App Store 后,文件大小将小于您的通用二进制文件,因为每个设备只会获得适当的图像密度。
You can check file-sizes here: iTunes Connect > My Apps > Your App > Activity > Your Build > App Store file-size
您可以在此处检查文件大小:iTunes Connect > 我的应用程序 > 您的应用程序 > 活动 > 您的版本 > App Store 文件大小