開發dislike的桌面端,遇到一個問題。測試安裝包時發現沒有菜單,dock欄上也沒有應用圖標。在開發模式下,自己添加的菜單都能正常顯示。網上搜了半天,也沒找到解決方案。按照以往的經驗,這種問題如果搜索不到想要的結果,那說明這不是一個常見的錯誤,大概率是自己犯了比較蠢的錯誤。
通過分析,覺得問題還是出在打包這個過程。仔細看了一下打包的配置,發現mac的相關配置如下:
mac: {
icon: 'build/icons/icon.icns',
extendInfo: {
LSUIElement: 1
}
}
LSUIElement 這個配置很奇怪,不是我主動加的,之所以有這個東西應該是在copy別人配置文件時不小心拷過來的。仔細一查LSUIElement的作用,就發現了問題的所在。
LSUIElement
Specifies whether the app is an agent app, that is, an app that should not appear in the Dock or Force Quit window. See LSUIElement for details.
LSUIElement設置成0就解決問題了。