-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-Update quitAndInstall Not Working On Mac #1604
Comments
I've made another donation. Any chance of getting some help with this issue? |
Fixed in the electron-updater 2.0.0 |
It is not electron-updater issue. Please see electron/electron#3583 As you have made a donation, issue was investigated by me for you. You need to modify your code: setImmediate(() => {
app.removeAllListeners("window-all-closed")
if (focusedWindow != null) {
focusedWindow.close()
}
autoUpdater.quitAndInstall(false)
})
If still no luck — try Don't forget to update to electron-updater 2.1.1 |
Thanks @develar. Both issues are now resolved. Mac auto-updates are working nicely. Appreciate your help. |
Did not work for windows. |
@develar I am having same issue
|
@SweetEvil unfortunately, the author left out a critical piece of information from the documentation -- auto updating will not work unless your Mac application is signed. I found this out by reading through the electron docs for auto updating.
As electron-builder makes use of Squirrel.Mac, this may be the cause of your issue. |
@purplekrayons My issue was with me using dmg format but zip format was needed to make it work. I just changed the format and it worked for our customers fine 👍 |
@SweetEvil Most interesting. Are you signing your Mac app? I wasn't able to get mine working -- to note I am using .zip -- this makes me think perhaps I have another thats causing my mac clients not to auto-update. |
I (quite naturally) had a /**
* ensureSafeQuitAndInstall
*
* @access public
* @return void
*/
function ensureSafeQuitAndInstall() {
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
app.removeAllListeners('window-all-closed');
var browserWindows = BrowserWindow.getAllWindows();
browserWindows.forEach(function(browserWindow) {
browserWindow.removeAllListeners('close');
});
} Hope this is helpful to someone out there :) |
This (we think) just solved a massive issue with our app's upgrade flow. Thanks! |
ps. my loom hasn't worked for ages ;) |
gotta clear all listeners on all the windows for quitAndInstall to work. Now auto-update works as expected on mac. thanks to the proposed fix on this issue: electron-userland/electron-builder#1604 (comment) License: MIT Signed-off-by: Oli Evans <[email protected]>
@onassar where did you use that helper function, I run into similar issue but I can't fix the issue |
Sadly, it's been years, and I ended up abandoning our attempt at a native (Electron wrapped) app. At the time, Electron required way (way way) too much low-level logic to work reliably. It's been years, so my guess is it's not as bad anymore. But I'm not sure where exactly I put that. Likely in the boot script (or whatever the language equivalent of that is these days). |
thanks. @develar |
* fix: app updater quit and install not working electron-userland/electron-builder#1604 * docs(changeset): Fixed app updater quit and install
"electron-builder": "^18.2.1"
"electron-updater": "^1.16.0"
Target: Mac
My auto-update on Windows is working fine. However I still have two issues on the Mac.
On the Mac it recognises that there is an update then asks the user if they want to download and install. If the user responds 'Yes' then the update is downloaded and the user is advised that the new version is downloaded and will be installed when they click OK. However the quitAndInstall never seems to get called. If I close the app and re-open it again it just goes through the same process. Also on Mac my progress is not logged to my log file, nor is the status bar working. Both of these things work correctly on Windows. See code and log file below.
log.txt
`autoUpdater.on('download-progress', (progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
log.log('info', log_message);
mainWindow.setProgressBar((progressObj && progressObj.percent) ? progressObj.percent / 100 : -1)
});
The text was updated successfully, but these errors were encountered: