macos:Updating-installed-apps
出自UXGuide.net
请帮助我们修订和更新本文的中文部分
本文的中文部分虽然取自官方最新中文版本,但与英文原版相比已落后了一年多,可能无法反映英文版本中最近的修改,且文中笔误、前后译法矛盾、未翻译完全的片断较多,请您帮助一起修订完善。详情参见中文版修订完善计划。
程序更新
Updating Installed Applications
If you need to update an already installed application, you should provide an installer that modifies only the files required for the new version. Remember that files may have been renamed or moved; don’t look only in the Applications directory and don’t rely exclusively on filenames to identify your application files. Instead, check for creation and modification dates, version numbers, file size, and so on to uniquely identify your application. If you detect multiple versions of your application, provide information about each, such as the location and creation date, so that the user can choose which one to update.
如果您需要更新一个已安装的程序,您应该提供一个仅仅包含新版本中更改的文件的安装包。记住,文件可能被重命名或者被移走,不要只查看Applications目录,也不要仅依赖于文件名来识别您的程序,而是检查创建和更改日期,版本信息,文件大小等来唯一确定您的程序。如果您检查到您程序的多个版本,提供每个版本的具体信息,如位置,创建日期等,以方便用户选择更新哪个程序。
Macintosh users are accustomed to using Software Update in System Preferences to upgrade the operating system and system software. Upgrading the operating system has implications different from those for upgrading a third-party application, however, and the user experiences for these procedures must reflect this. Third-party applications should not attempt to duplicate the user experience of Software Update. If you want to provide your users with automatic updates, offer a streamlined and consistent user experience following the guidelines in this section.
Macintosh用户习惯使用系统偏好设置中软件更新来升级操作系统和系统软件。然而,升级操作系统和升级第三方软件有不同的含义,升级的过程必须反映这一点。第三方程序不应该重复软件更新的用户体验,如果您想向用户提供自动更新的功能,请遵守本小节所描述的准则。
The goal of a software update mechanism is to be convenient, yet unobtrusive. To achieve this, it’s essential that your application perform all software update procedures at launch time only. In particular, you should avoid checking for updates using a background process or standalone, faceless utility that executes independently of your application. If the user is unaware that such a process is running even after your application quits, the random appearance of update notifications will be unexpected and may be unsettling.
软件更新机制的目标是方便而不显眼。为了达到这个目标,您的程序应该仅在启动的时候进行软件更新的过程。特别地,您应该避免使用一个后台进程或者独立的工具进程来检查更新。如果用户没有意识到您的程序退出后这些进程仍然在运行,那么随机出现的更新通知则会让用户很困惑。
Note: If you provide a first-time user experience with your application, such as a setup assistant, it’s appropriate to perform a check for available updates while the user is engaged in this task. If a newer version of your application is available, allow the user to upgrade immediately, before the user begins working with the currently installed version. On subsequent launches, follow the guidelines below.
注意:如果您提供了类似于配置助手这种功能,则最好在开始这些功能前进行更新检查。如果一个新版本的程序可用的话,允许用户在开始使用已安装的当前版本前立即升级。在随后的启动过程中,遵守下面的准则。
To provide a convenient application-update experience, follow these steps:
为了提供一个方便的程序更新体验,请遵守如下步骤:
- When your application fully launches the first time after installation, start a separate thread that checks for updates.
当您的程序安装后第一次启动时,启动一个独立线程来检查更新。 - If a newer version is available, keep track of this fact in your application. Do not notify the user at this time.
如果新版本可用,在程序中记录这个信息而不是立即通知用户。 - The next time your application launches, check the state of update availability you determined in step 2. If a newer version is available, immediately notify the user.
下一次程序启动时,检查第2步中的更新可用性。如果有新的版本可用,立即通知用户。
- If a newer version is not available, start a separate thread to check for updates and keep track of the results in your application. Do not notify the user at this time.
如果没有新版本可用,启动一个单独的线程来检查更新,并将结果保存在程序内部。不要这时候通知用户。
Your application then repeats step 3 every time it launches. If the user chooses to install a newer version, the upgraded application begins again with step 1.
您的程序在每次启动的时候重复步骤3.如果用户选择安装新的版本,则升级后的程序从步骤1开始。
Using this method confers several advantages:
使用这种方法有很多好处:
- You avoid slowing launch time by using a separate thread after your application launches.
- 在程序启动后使用独立的线程可以避免降低程序启动的时间。
- Checking for updates frequently involves making an Internet connection. If you do this on the application’s main thread, it can significantly slow your launch time.
- 检测更新的操作经常需要internet链接,如果您在主线程做这种操作,程序的启动时间将会显著降低。
- Users will appreciate receiving an update notification consistently and immediately at launch time, rather than at random times during their work.
- 用户更习惯于在程序启动时收到更新的通知,而不是正在工作地某个时刻。
- Because the display of the update notification depends on the quick check of an internal state (not on the completion of a potentially lengthy search for available updates) you ensure it always arrives immediately at launch time.
- 因为更新通知的显示仅依赖于内部状态的检查,而不是对可用更新长时间的搜索,所以您可以确保在启动时它是立即可用的。
- You do not have to design additional dialogs that ask the user if update checks should be performed while your application is running.
- 您无需设计额外的对话框来询问用户在程序运行时是否需要执行更新检测。
- You avoid startling the user with unexpected and intrusive update notifications that occur outside the context of your running application.
- 避免在不适宜的时候弹出更新通知。
Allow the user to customize the software update behavior in your preferences window. A user should have the option to allow automatic software updates and the ability to check for updates immediately. Figure 7-3 shows an example of how a sample preferences window can be modified to do this.
您应该允许用户在偏好设置窗口中定制您的软件更新行为。用户应该可以选择让软件更新自动运行和立即进行检测。图7-3显示了偏好设置窗口的一个范例。
Figure 7-3 An application-update preferences window
图 7-3 程序更新的偏好设置窗口
When your application checks its internal update state and finds that a newer version is available, display an alert that describes the type and availability of the update and gives the user the option to get the new version. You can customize the alert for a free or for-purchase update. Figure 7-4 shows how the alert for a free update should look.
当您程序检测到内部状态显示更新可用时,立即显示通知窗口,描述更新的类型和可用性,并给用户获取更新的选项。您可以将更新定义为免费或者收费的。图7-4显示了一个免费的更新通知。
Figure 7-4 An alert to describe the availability of a free application update
图 7-4 免费升级的更新通知
Each element of the alert shown in Figure 7-4 is required. In many cases, the only changes you need to make are to replace MyApplication and MyCompany with your application and company names and to badge the caution icon with your application icon. Note that it is important to display the caution icon in this alert because the installation of software has the potential to destroy user data. For more information about the components of an alert (and using the caution icon), see “The Elements of an Alert” You might also choose to replace the phrase “newer version of” with a phrase like “minor update to”, if appropriate.
图7-4中通知窗口的每个控件都是必须得。大部分情况下,您所需要的修改仅仅是将MyApplication和MyCompany替换成您的程序名字和公司名字,并把图标换成您的程序的图片。 注意, 通知窗口显示的注意图标很有必要,因为软件安装可能会损坏用户数据。关于通知窗口的更多信息,请参考 “告警对话框中的控件”。
The software update alert in Figure 7-4 displays the main message in emphasized (bold) system font and the explanatory text in small system font. A simplified alert (one that displays only the main message) is not used here because it does not give the user enough information to customize the update process.
图7-4中的软件更新通知以系统粗体显示了主要信息,并使用小号系统字体显示解释性字体。这儿没有使用简化的通知窗口(只显示主要消息),因为它没有给用户足够的信息来定制更新过程。
The three required alert buttons shown in Figure 7-4 describe the actions the user can take. Each button leads to a specific set of actions your application should perform:
图7-4的三个按钮描述了用户可以采取的操作。每个按钮都对应着您的程序的特定操作集合。
- The Change Preferences default button removes the alert and opens the software update preferences window. After the user adjusts the software update preferences and dismisses the preferences window, your application resumes.
- 更改偏好设置按钮是默认按钮,将打开软件更新的偏好设置窗口。在用户更改了软件更新的设置并关闭窗口后,您的程序将继续运行。
- The Ask Again Later button leaves the internal update state unchanged and removes the alert. Because the state is still set to indicate the availability of an update, the alert will appear again the next time the user launches your application.
- 稍后询问按钮将保持内部更新状态并关闭通知窗口。因为内部状态仍然显示更新可用,所以下一次用户启动您的程序是通知窗口仍会弹出。
- The Upgrade Now button resets the internal state, removes the alert, and initiates a download of the new software. After the download is complete, your application asks the user to save all open documents and updates with the downloaded version.
- 现在升级按钮将重置内部状态,关闭通知窗口,并开始新版本软件的下载。在下载完成后,您的程序应让用户保存所有打开的文档并且使用下载的程序更新。
If you offer a software update for purchase, you should use an alert like the one shown in Figure 7-5
如果您提供的更新是需要购买的,您应该使用如图7-5所示的通知窗口。
Figure 7-5 An alert to describe the availability of a for-purchase upgrade
图 7-5 需要购买升级的软件更新通知
The alert in Figure 7-5 is different from the alert for a free software update in two ways:
图7-5中的通知窗口和免费升级的软件更新通知窗口有两个不同:
- The main message clearly states that the new version of the software is for purchase and the question leads the user to click the Learn More button if they’re interested in receiving the upgrade.
- 主消息应该清楚地标明新版本需要购买,并且引导用户点击“更多”按钮,如果他们对升级感兴趣的话。
- The Learn More button resets the application’s internal state, removes the alert, and leads to your company’s website where the user can learn more about the update and select a purchasing option. If the user chooses to upgrade the software, a bundle or installation package should be downloaded independently of the currently running application. The user can then install the update when it’s convenient.
- ”更多“按钮将重置内部状态,关闭通知窗口,并且指向您公司的网站,在那用户可以得知更多的关于更新的信息以及购买的选项。如果用户选择升级软件, 则软件安装包会独立的下载。用户可以选择方便的时候安装更新。