xcode - 始终保持最新状态

标签 xcode cocoa sparkle

我最近添加了 Sparkle 框架 [ http://sparkle-project.org/ ] 到我的 cocoa 应用程序。当我向 appcast.xml 添加虚拟新项目(版本 1.1),然后尝试从版本 1.0 更新时,它显示“XXX 1.0 是当前可用的最新版本”。

我已经研究这个问题有一段时间了,并且我已经阅读了文档[ https://github.com/sparkle-project/Sparkle/wiki ] 好几次了,都没有成功。

这是我的 Info.plist:

<?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>BuildMachineOSBuild</key>
    <string>11E53</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Snappi</string>
    <key>CFBundleExecutable</key>
    <string>Snappi</string>
    <key>CFBundleIconFile</key>
    <string>snappi_icon.icns</string>
    <key>CFBundleIdentifier</key>
    <string>com.snppi.Snappi</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>Snappi</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>100</string>
    <key>DTCompiler</key>
    <string>com.apple.compilers.llvm.clang.1_0</string>
    <key>DTPlatformBuild</key>
    <string>4E3002</string>
    <key>DTPlatformVersion</key>
    <string>GM</string>
    <key>DTSDKBuild</key>
    <string>11E52</string>
    <key>DTSDKName</key>
    <string>macosx10.7</string>
    <key>DTXcode</key>
    <string>0433</string>
    <key>DTXcodeBuild</key>
    <string>4E3002</string>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.productivity</string>
    <key>LSBackgroundOnly</key>
    <false/>
    <key>LSMinimumSystemVersion</key>
    <string>10.6</string>
    <key>LSUIElement</key>
    <string>1</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2012 Marshall Moutenot All rights reserved.</string>
    <key>NSMainNibFile</key>
    <string>StatusBar</string>
    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
    <key>SUFeedURL</key>
    <string>http://app.snppi.com/Snappi.xml</string>
    <key>SUPublicDSAKeyFile</key>
    <string>dsa_pub.pem</string>
</dict>
</plist>

还有我的 appcast.xml(重命名为 Snappi.xml):

<?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>Snappi</title>
    <link>http://app.snppi.com/Snappi.xml</link>
    <description>
      Send snapshots and files to friends in seconds. Snappi automatically generates a short link, so all you have to do is press paste.    
    </description>
    <language>en</language>
    <item>
      <title>Version 1.1</title>
      <sparkle:releaseNotesLink>
    http://app.snappi.com
      </sparkle:releaseNotesLink>
      <pubDate>Sat, 4 Aug 2012 20:26:11 +0000</pubDate>
      <enclosure 
    url="http://app.snppi.com/Snappi_1_1.dmg"
    sparkle:version="1.1"
    length="10518528"
    type="application/octet-stream" 
    sparkle:dsaSignature="MC0CFHaN/qB0aAb6V9rHMVHCLoBrTyJ8AhUAl0Wazod0rtzpxsvIaL0aYTg+KpQ=" 
    />
    </item>
    <item>
      <title>Version 1.0</title>
      <sparkle:releaseNotesLink>
    http://app.snappi.com
      </sparkle:releaseNotesLink>
      <pubDate>Sat, 4 Aug 2012 18:26:11 +0000</pubDate>
      <enclosure 
    url="http://app.snppi.com/Snappi_1_0.dmg"
    sparkle:version="1.0"
    length="10518528"
    type="application/octet-stream" 
    sparkle:dsaSignature="MC0CFHaN/qB0aAb6V9rHMVHCLoBrTyJ8AhUAl0Wazod0rtzpxsvIaL0aYTg+KpQ=" 
    />
    </item>
  </channel>
</rss>

谢谢!

补充:再考虑一下,这是否会导致与“您已经是最新的”不同的行为?我感觉会,但我不确定。

最佳答案

Sparkle 将 appcast 中的 Sparkle:version 属性与 plist 中的 CFBundleVersion 进行比较(这是机器可读版本)。

因此,在这里,您的 CFBundleVersion (100) 表示您拥有比 appcast 中更新的 (>1.0) 版本。

另一方面,CFBundleShortVersionString(对应于强制转换中的sparkle:shortVersionString)用于“用户可显示”版本。

关于xcode - 始终保持最新状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11813467/

相关文章:

ios - 试飞 session 为空

ios - UIView 约束在 iPad 上不显示相同的结果

cocoa - 从另一个类调用时 NSTextfield 未更新

iphone - 使用 NSMutableDictionary 作为属性的后备存储

cocoa - 像这样的 UI 控件的预制 Cocoa 组件? (圆角矩形显示一堆项目)

macos - 运行最新版本时没有 "up to date"信息?

ios - iphone 应用程序图标在 iPhone 6 的 Xcode iOS 模拟器中没有改变

ios - Xcode 上是否需要在 Archive 之前使用 Clean?

cocoa - Sparkle 自动更新的代码签名问题

cocoa - Spark 框架 : How to change application name?