錯誤現(xiàn)象
將Flutter項目嵌入到iOS的Native應用中,打包上傳Appstore時拋出以下錯誤:
Invalid Bundle Structure - The binary file 'kdh.app/Frameworks/App.framework/App' is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.
錯誤里的關鍵詞如下:
- Invalid Bundle Structure
- can’t contain standalone executables or libraries
- 出錯的文件:App.framework/App
打包后的文件里包含一個App可執(zhí)行文件,其實就是dart代碼的庫,按理說這里應該是一個 App.framework, 而不是一個App 文件荷憋;
錯誤的截圖如下:
解決方案
-
第一步:Xcode > Product > Archive,先確保能正確夠打包;(打包過程中可能會出現(xiàn)一些奇怪的問題回頭在說)
截屏2022-06-08 09.19.59.png -
第二步:從打包結果中找到 "App" 這個可執(zhí)行文件侍瑟,然后刪除它;
Xcode > Window > Organizer > Show in Finder > 顯示包內(nèi)容
截屏2022-06-08 09.53.55.png -
第三步:從xcarchive包中找到APP的應用文件丙猬,例如:
截屏2022-06-08 09.56.20.png -
第四步:進入APP應用程序的壓縮包
截屏2022-06-08 09.56.51.png -
第五步:在壓縮包中找到對應的可執(zhí)行文件(就是報錯中的App.framework/App)
截屏2022-06-08 10.00.38.png -
第六步:進入App.framework壓縮包涨颜,找到App文件,刪除它茧球;
截屏2022-06-08 10.02.10.png 最后:重新上傳Apptore
應用程序包倒是可以上傳了庭瑰,但是自動審核失敗了,失敗提示為:
Dear Developer,
We identified one or more issues with a recent delivery for your app, "KDH" 1.2.0 (1). Please correct the following issues, then upload again.
ITMS-90036: This bundle is invalid - The Info.plist file for App.framework is missing or could not be read.
Best regards,
The App Store Team
最終的解決方案
但凡聰明一點都不要用這個方法抢埋,真的是太慘了...
之前的老項目使用 Rosetta方式啟動XCode弹灭,而且還必須使用 Legacy build system來進行編譯才能正確運行在模擬器、真機揪垄,并打包上傳Apptore穷吮。
因此根據(jù)錯誤現(xiàn)象,判斷下來應該是項目中某些配置有問題饥努,但是因為學藝不精捡鱼,無法找到具體的錯誤位置,只能采取最慘烈的方式:重建整個項目酷愧;
(1)重新建立一個空項目
(2)引入flutter
(3)導入各種第三方的pod庫及其他的靜態(tài)庫
(4)最后把全部的代碼復制過去驾诈。
通過上述慘烈的方法,問題總算解決了溶浴,打包上傳AppStoer可以正常進行了乍迄。