No activity after "Checking for Updates" dialog

Asked by syuyapfaat

I've followed the instructions by the letter, as far as I can tell, to add Sparkle to my app, which is an Input Method that uses an App Bundle. I configured a menu item to check for updates and clicking on it makes the "Checking for Updates" dialog quickly flash on to the screen and disappear. Nothing else happens. I don't see any output to the Console describing any sort of error or exception. I implemented the delegate method updater:didFindValidUpdate: and it does get called with a well-formed SUAppcastItem, and I can successfully log its various fields to the console.

Trying to check for updates again using the menu item does nothing at all (delegate methods do not get invoked). Incidentally, if I change the app's version to the current version on the server, it does successfully display a dialog box telling me I have the most up-to-date copy, so it's definitely parsing the app cast to some extent.

This is what my app cast looks like:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
   <channel>
      <title>粵語輸入法更新日記</title>
      <link>http://karanmisra.com/syuyapfaat/appcast.xml</link>
      <language>en</language>
         <item>
            <title>Version 1.2</title>
            <pubDate>Wed, 13 Jan 2010 20:10:00 -0800</pubDate>
            <enclosure url="http://karanmisra.com/syuyapfaat/CantoInput-1.2.app.zip" sparkle:version="1.2" type="application/octet-stream" sparkle:dsaSignature="MCwCFEC0wk1rjPfZe+JtsutedVblG/xpAhQ72KtMb8/SagQwIpeeIX+JlKKPbA==" />
         </item>
   </channel>
</rss>

And these are the relevant bits from the Info.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>CFBundleDevelopmentRegion</key>
 <string>English</string>
 <key>CFBundleExecutable</key>
 <string>CantoInput</string>
 <key>CFBundleIdentifier</key>
 <string>com.karanmisra.inputmethod.CantoInput</string>
 <key>CFBundleInfoDictionaryVersion</key>
 <string>6.0</string>
 <key>CFBundleName</key>
 <string>«PROJECTNAME»</string>
 <key>CFBundlePackageType</key>
 <string>APPL</string>
 <key>CFBundleSignature</key>
 <string>????</string>
 <key>CFBundleVersion</key>
 <string>1.2</string>
 <key>SUPublicDSAKeyFile</key>
 <string>dsa_pub.pem</string>
 <key>SUFeedURL</key>
 <string>http://karanmisra.com/syuyapfaat/appcast.xml</string>
 <key>SUEnableAutomaticChecks</key>
 <true/>
 <key>SUEnableSystemProfiling</key>
 <true/>
</dict>
</plist>

Question information

Language:
English Edit question
Status:
Solved
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Solved by:
syuyapfaat
Solved:
Last query:
Last reply:
Revision history for this message
Andy Matuschak (andymatuschak) said :
#1

So, with the Info.plist and appcast you've provided, you do have the most recent version! You're saying this happens even when CFBundleVersion < 1.2?

What happens if you don't implement any delegate methods?

Are you using 1.5b6 or a more recent version from Github?

Revision history for this message
syuyapfaat (karanm) said :
#2

When the CFBundleVersion == 1.2, then the "You have the latest version" dialog appears correctly. When CFBundleVersion < 1.2, the "Checking for Updates" window disappears and no other UI appears (I checked that there weren't any windows hiding behind other windows.)

If I don't implement the delegate methods, the exact same thing happens.

Yes, I am using 1.5b6, but downloaded directly from the homepage (http://sparkle.andymatuschak.org/)

Revision history for this message
syuyapfaat (karanm) said :
#3

OK, I think I've figured out why this is happening, but I still need a solution for it.

Since, as I mentioned, my app is an Input Method, it runs with the LSBackgroundOnly flag set to true. I turned this flag off just now to see if it would make any difference, and now the window does show up (albeit in the background and I have to click the Dock icon to bring it to the front). However, I need this to work even when the app is running in background-only mode. The "Checking for Updates" window doesn't seem to have a problem with that...

Thanks!

Revision history for this message
Hofman (cmhofman) said :
#4

You seem to contradict yourself. Your Info.plist does not have the LSBackgroundOnly flag set. And apps with that flag set don't have a menu or a dock item.

I think the problem is that background-only apps never show normal window, they can only show floating windows. And the "You're up-to-date" alert is a floating window, while Sparkle's own windows run at normal level. Of course that should not change. Background-only apps are not supposed to show this kind of windows, so you're trying to abuse the system. To properly support this you should use LSUIElement rather than LSBackgroundOnly. Of course I don't know exactly what your requirements are, but you really have to think about what your app's role is (if it needs to be background-only rather than a UIElement, it shouldn't really have update functionality like in Sparkle). If you really musty abuse the system, you should patch Sparkle yourself, and run the UI at floating window level. However contemplate that this is considered rude behavior.

Revision history for this message
Hofman (cmhofman) said :
#5

I was wrong about one thing: background-only apps /can/ show windows at normal window level (Google gave me the wrong idea). The real reason for the fact you don't see the window is that it hides-on-deactivate, and background-only apps are never active. The fact that background-only apps are, well, background-only, is also the reason why the windows always show in the background. This would even be true when Sparkle would try to force the app to become active (as it does with LSUIElement apps). The main problem remains that you shouldn't use UI-based updating from Sparkle in a background-only app. When you abuse the system, things not working is expected behavior.

Revision history for this message
syuyapfaat (karanm) said :
#6

So, is the answer that I cannot use Sparkle with background-only apps? If that is so, I will look for a different solution.

You use the word "abuse" rather liberally. I wouldn't do that myself, especially because I didn't notice any place where it quite obviously said Sparkle was not supposed to work for background apps. In any case, Input Methods need to update themselves and I thought Sparkle would work rather well for me. If not, oh well, I'll find something else.

Revision history for this message
syuyapfaat (karanm) said :
#7

Anyway, it looks like setting LSUIElement (which I was not aware of previously) to true fixed my problem. The application still does not have a Dock icon (as I need it to be), but Sparkle works!

Thanks for your help, both Andy and Hofman!

Revision history for this message
Hofman (cmhofman) said :
#8

"So, is the answer that I cannot use Sparkle with background-only apps? If that is so, I will look for a different solution.

You use the word "abuse" rather liberally. I wouldn't do that myself, especially because I didn't notice any place where it quite obviously said Sparkle was not supposed to work for background apps. In any case, Input Methods need to update themselves and I thought Sparkle would work rather well for me. If not, oh well, I'll find something else."

No, I'm saying that it makes no sense in principle. It's in the nature of Sparkle to use UI to communicate updates with the user. And it's in the nature of background-only apps not to communicate through UI. Therefore the two are not consistent. If you want two things to work that are principally inconsistent, that's abuse.

Revision history for this message
syuyapfaat (karanm) said :
#9

I know that that is the case now, but it wasn't entirely obvious to me that this was the case before because Sparkle's Checking for Updates window was showing up and background apps can display UI (it just has to be floating above everything else), so although I see your point, it was not entirely obvious, that's all I'm saying.

What you're saying makes sense, it's just that you use language that's a little stronger than necessary for such a peaceful discussion.

Revision history for this message
Andy Matuschak (andymatuschak) said :
#10

Sorry for the trouble! I'm glad you figured it out. I didn't know this consequence of LSBackgroundOnly, and in fact, I'd never seen it used before! Everyone always just uses LSUIElement—maybe this is why!