2016-04-19 163 views
2

我有一個用Qt構建的OSX應用程序。它是經過代碼簽名的,被打包以適應macstore並且已經被蘋果批准,並且已經準備好在mac商店中出售。productbuild路徑在安裝時被忽略

雖然在安裝它之後,它會安裝到它在打包過程中所在的位置,而不是/ Applications。

或者,我正在創建一個.dmg文件包,我可以將其安裝到/ Applications中。

在構建過程結束時,我運行這些命令:

codesign --force --deep --verify MyApp.app/ --entitlements ${INSTDIR}/Entitlements.plist -s "3rd Party Mac Developer Application: Company Name" 
productbuild --component MyApp.app /Applications --sign "3rd Party Mac Developer Installer: Company Name" MyApp.pkg 

其結果是PKG,其中我試圖通過安裝程序安裝:

$ sudo installer -store -pkg MyApp.pkg -target/
installer: Note: running installer as an admin user (instead of root) gives better Mac App Store fidelity 
installer: MyApp.pkg has valid signature for submission: 3rd Party Mac Developer Installer: Company Name (key) 
installer: Installation Check: Passed 
installer: Volume Check: Passed 
installer: Bundle com.CompanyName.MyApp will be relocated to /Users/peti/dev/build/bin/Mac/release/MyApp.app 
installer: Starting install 
installer: Install 0.0% complete 
installer: Install 17.1% complete 
installer: Install 96.4% complete 
installer: Install 100.0% complete 
installer: Finished install 

在產品生成後,重新定位說/應用程序,但它沒有安裝它!在隨後的運行中,它會說錯誤的路徑。我也嘗試從不同的位置安裝。

我也試着從Mac Store安裝應用程序,它也是這樣做的......它進入了不正確的路徑。

我用:

pkgutil --expand 

抽取軟件包。 PackageInfo文件這樣說:

<pkg-info overwrite-permissions="true" relocatable="false" identifier="com.CompanyName.MyApp" postinstall-action="none" version="3.0.0" format-version="2" generator-version="InstallCmds-502 (14F1605)" install-location="/Applications" auth="root" preserve-xattr="true"> 

任何想法可能會出錯?我試圖谷歌解決方案,但沒有運氣。這個不正確的路徑可以存儲在哪裏?在productbuild之前我沒有看到嵌入到任何文件中的路徑。 productbuild是否奇怪?

+0

'.dmg'是一個磁盤鏡像,而不是一個包,但是你當然可以在其上存儲'.pkg'。 –

+0

@我知道,我不明白爲什麼包裝的地方與安裝路徑有關。 – tothphu

+1

如果您的意思是構建文件的位置,那是因爲它使用它來確定將文件安裝到哪裏。 –

回答

1

最後我想我有一個解釋。

它安裝在每臺機器上,除了我們的生產機器。原因似乎是,在從文件系統的任何位置執行命名的MyApp.app後,osx會記住該路徑。因此,當您下次嘗試安裝它時(更新?),它將更新已知路徑上的應用程序。

甚至更​​奇怪的情況是,當你有兩個應用程序的「安裝」(兩個副本),並且你試圖再次安裝它時,它會在兩個實例之間交替安裝它!聞起來像一個錯誤,蘋果永遠不會修復。

感謝您的幫助@ l'L'l。如果你能解釋我這種行爲會是一個加分。