【问题标题】:Unity3d iOS build exportArchive IPA sizeUnity3d iOS 构建导出存档 IPA 大小
【发布时间】:2016-07-26 14:43:03
【问题描述】:

已经有几个关于 Unity3d IPA 大小的问题,但我发现没有一个可以正确解决问题。

问题是,如果我通过 XCode GUI 导出 IPA,我有一个 24mg 的 IPA,如果我使用命令行导出,我得到一个 160mg 的 IPA。

步骤:

  • 使用默认 iOS 设置从 Unity 创建项目
  • 在 Xcode 7.3.1 中打开,选择 Product -> Archive

现在,通过 GUI:

  • 打开Organizer,选择存档、导出、保存以供企业部署,完成

24mg 异丙醇

通过命令行:

  • 从 Organizer 获取由 xcode 生成的存档的路径(在 Finder 中显示
  • 运行xcodebuild -exportArchive -archivePath ~/Library/etc/etc/Unity-iPhone.xcarchive -exportPath build/Unity-iPhone -exportFormat ipa -exportProvisioningProfile "My Provisioning Profile"

这给了我 160 毫克 IPA...

$ ls -lh
total 382480
-rw-r--r--  1 iz  staff   163M Jul 26 15:28 cmdline.ipa
-rw-r--r--  1 iz  staff    23M Jul 26 15:28 gui.ipa

解压缩 IPA 文件并比较树(使用 find . -exec ls -lh {} \;diff):

$ diff gui.txt cmdline.txt 
55,56c54
< -rw-r--r--  1 iz  staff   416B Jul 26 12:15 ./Payload/childplayground.app/archived-expanded-entitlements.xcent
< -rwxr-xr-x  1 iz  staff    30M Jul 26 12:23 ./Payload/childplayground.app/childplayground
---
> -rwxr-xr-x  1 iz  staff   270M Jul 26 12:27 ./Payload/childplayground.app/childplayground

这清楚地表明,唯一的大小差异在于主二进制文件本身。再加上 GUI 生成的 IPA 包含这个命令行没有的 archived-expanded-entitlements.xcent 文件...

关于我可以在命令行中更改什么以获得相同的 IPA 大小的任何提示?

【问题讨论】:

  • xcodebuild 命令行的末尾不应该有一个archive 参数吗?
  • 这是上一步(归档),通过 GUI 完成(在本例中)。无论如何都解决了,现在发布答案...
  • 仅供参考,也在这里问过; stackoverflow.com/questions/39309133/…

标签: ios xcode unity3d


【解决方案1】:

我想我不应该忽略 deprecated 警告而改用-exportOptionsPlist

生成的 IPA 与 GUI 相同 24mg。

为了完整起见,使用的exportOptions.plist 文件是:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>method</key>
        <string>enterprise</string>
    </dict>
</plist>

和命令行:

xcodebuild -exportArchive -archivePath ~/Library/etc/etc/Unity-iPhone.xcarchive -exportPath build/Unity-iPhone -exportOptionsPlist exportOptions.plist

删除exportFormatexportProvisioningProfile 并改用exportOptionsPlist

【讨论】:

    猜你喜欢
    • 2016-01-08
    • 1970-01-01
    • 2016-07-03
    • 1970-01-01
    • 2012-10-24
    • 1970-01-01
    • 2020-01-23
    • 2017-04-23
    • 2020-06-29
    相关资源
    最近更新 更多