Skip to content
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

dev: Configuration.shared.updater return nil on setting and getting automaticallyChecksForUpdates #363

Closed
CanglongCl opened this issue Jan 25, 2024 · 10 comments
Labels

Comments

@CanglongCl
Copy link
Collaborator

CanglongCl commented Jan 25, 2024

image

@NeverAgain11 Can you have a look?

@CanglongCl CanglongCl added the dev label Jan 25, 2024
@NeverAgain11
Copy link
Collaborator

image
it's not nil in my side.

@NeverAgain11
Copy link
Collaborator

Have you checked that the appDelegate is nil?

@CanglongCl
Copy link
Collaborator Author

Have you checked that the appDelegate is nil?

Yes, appDelegate is nil as well.

@NeverAgain11
Copy link
Collaborator

Have you checked that the appDelegate is nil?

Yes, appDelegate is nil as well.

can you replace appDelegate to

var appDelegate: AppDelegate? {
        NSApp.delegate as? AppDelegate
    }

and see if it can solve?

@CanglongCl
Copy link
Collaborator Author

Have you checked that the appDelegate is nil?

Yes, appDelegate is nil as well.

can you replace appDelegate to

var appDelegate: AppDelegate? {
        NSApp.delegate as? AppDelegate
    }

and see if it can solve?

It is still nil

@NeverAgain11
Copy link
Collaborator

image

perhaps casued by this.
NSApplicationMain not get called.

@CanglongCl
Copy link
Collaborator Author

@tisfeng Please have a look at this issue. I'm really not familiar with NSApp's life circle.

@tisfeng
Copy link
Owner

tisfeng commented Jan 25, 2024

image perhaps casued by this. `NSApplicationMain` not get called.

Yes, I've found this too, when started with SwiftUI, it doesn't initialize Main.storyboard as it did before, and updaterController, which is an IBOutlet that depends on it, isn't initialized, resulting in updater being nil as well.

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (weak) IBOutlet SPUStandardUpdaterController *updaterController;

@end
var updater: SPUUpdater? {
        appDelegate?.updaterController.updater
    }

@tisfeng
Copy link
Owner

tisfeng commented Jan 25, 2024

Maybe we can refer to the Sparkle document and initialize updaterController with code instead.

https://sparkle-project.org/documentation/programmatic-setup/

@tisfeng
Copy link
Owner

tisfeng commented Jan 25, 2024

I found that there's already another updaterController created in EasydictApp.swift, we may need to reorganize the code in this part.

https://github.com/tisfeng/Easydict/blob/dev/Easydict/NewApp/EasydictApp.swift#L64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants