2016-07-26 44 views
1

Unity3d IPA尺寸上已經有幾個問題,但是我沒有發現能夠正確解決問題的問題。Unity3d iOS版本導出存檔IPA大小

問題是,如果我通過XCode GUI導出IPA,並且如果使用命令行導出,則會得到一個160mg的IPA。

步驟:

  • 使用默認的iOS設置
  • 在Xcode 7.3.1開放創建統一的項目,選擇產品 - >存檔

現在,通過圖形用戶界面:

  • 組織者,選擇歸檔,導出,保存爲企業部署,完成

IPA與24毫克

通過命令行:

  • GET路徑從主辦方通過Xcode中產生的歸檔(顯示於Finder
  • 運行xcodebuild -exportArchive -archivePath ~/Library/etc/etc/Unity-iPhone.xcarchive -exportPath build/Unity-iPhone -exportFormat ipa -exportProvisioningProfile "My Provisioning Profile"

這給了我160mg 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大小?

+0

不應該有一個'存檔''xcodebuild'命令行末尾的參數? – Droppy

+0

這是上一步(歸檔),通過GUI完成(在本例中)。無論如何,現在發佈答案... –

+0

fyi,也在這裏問; http://stackoverflow.com/questions/39309133/app-size-increased-drammatically-from-exported-ipa-to-itunes-connect# – AnneTheAgile

回答

1

我想我不應該忽視棄用警告和使用-exportOptionsPlist來代替。

生成與GUI具有相同24mg的IPA。

爲了完整起見,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代替