首页 > 解决方案 > Sparkle checkForUpdatesInBackground 在网络服务器上没有请求

问题描述

在我的命令行应用程序中,调用 时[[SUUpdater sharedUpdater] checkForUpdatesInBackground],Sparkle 项目不会在我的网络服务器上放置 HTTPS 请求。我想要一个checkForUpdatesInBackground成功的电话,所以我知道我的设置是正确的。我正在通过 HTTPS 使用 Nginx 网络服务器,并查看该服务器的日志以确保正在请求 appcast.xml 文件。

我试过调试Sparkle框架,调用后发现checkForUpdatesInBackground,框架确实调用dispatch_asynchere。这给出了以下堆栈跟踪。

2018-12-20 06:46:46.037297-0800 MyApplication[28705:224144] Stack trace : (
0   ???                                 0x00000001005a7b0e 0x0 + 4300897038
1   MyApplication                       0x0000000100001af0 main + 0
2   Sparkle                             0x000000010036a5f9 -[SUAppcast fetchAppcastFromURL:inBackground:completionBlock:] + 1625
3   Sparkle                             0x0000000100372fff -[SUBasicUpdateDriver checkForUpdatesAtURL:host:] + 1423
4   Sparkle                             0x00000001003aabe5 -[SUUpdater checkForUpdatesWithDriver:] + 773
5   Sparkle                             0x00000001003aa41e -[SUUpdater checkForUpdatesInBackground] + 494
6   MyApplication                       0x0000000100001b9f main + 175
7   libdyld.dylib                       0x00007fff5ddd1085 start + 1
)

我的信息列表:

{
"SUAllowsAutomaticUpdates" = NO;
CFBundleIconFile = "myicon.icns";
CFBundleExecutable = MyApplication;
"SUAutomaticallyUpdate" = NO;
"SUScheduledCheckInterval" = 3600;
"SUEnableAutomaticChecks" = NO;
SUPublicEDKey = "0xe+xaH4VBOMIADOqOqBAZug/hnrCqBKUyCffx+8Qvw=";
SUFeedURL = "https://test.myurl.com/appcast.xml";
CFBundleVersion = "1.0.0.0";
"CFBundleShortVersionString" = "7.0";
CFBundleIdentifier = "nl.apps.myapp";
}

我的代码:

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        [[SUUpdater sharedUpdater] checkForUpdatesInBackground];
    }
}

为了等待请求结束,Sparkle 确实停止了我的应用程序的终止。在我的网络服务器上,我没有看到正在请求 appcast.xml,Sparkle 也没有显示包含任何更新信息的窗口。

标签: objective-csparkle

解决方案


就我而言,就像Rengers指出的那样,Sparkle 不起作用,因为它是一个命令行工具。这意味着不存在 Sparkle 依赖的主循环。Sparkle 使用dispatch_async将它的一些操作放在主事件队列上,例如源代码中。

为了克服这个问题,我将我的命令行工具变成了 GUI,现在一切正常。


推荐阅读