我应该如何使用帮助:Snow Leopard .help包中的URL?

时间:2010-03-10 15:49:24

标签: cocoa osx-snow-leopard

我正在为我的申请编写帮助手册。根据需要,我在我的应用程序的info.plist中有CFBundleHelpBookName和CFBundleHelpBookFolder键,我正在使用新的Snow Leopard .help包格式作为帮助手册。 Rehearsals.help/Contents/Info.plist中的各种键都按照Apple Help Programming Guide填充。正如预期的那样,当用户从“帮助”菜单中选择“排练帮助”时,我的帮助手册的索引页面(在适当的本地化中,当前只有英文版)将在帮助查看器中打开。

然而,捆绑包中实际上(当前)有两个HTML文件,index.html和support.html。我的理解是,如果我将一个命名锚点放在一个文件中,就像这样:

<a name="support"></a>

然后我可以从其他文件链接到它,如下所示:

<a href="help:anchor=support bookID=info.thaesofereode.Rehearsals.help">Support</a>

然而,这不起作用。也没有:

<a href="help:anchor=support">Support</a>

帮助查看器显示一张表“帮助查看器无法打开此内容。”,如果我在帮助查看器和帮助中启用调试日志记录,我会看到:

10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: help:anchor=support%20bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    willSendRequest: <NSMutableURLRequest apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help>
10/03/2010 15:46:02 HelpViewer[2049]    Start loading apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    Starting search for query "support" with return port com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] PID #2050 - received message #0: HPDStartMessageID
10/03/2010 15:46:02 helpd[2050] Process 2049 requested callback at com.apple.helpd-26755 and sent query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Run loops which have yet to start: (
    "com.apple.kbPlugin",
    "com.apple.helpbookPlugin"
)
10/03/2010 15:46:02 helpd[2050] Search for this query has been delayed 1 time: support
10/03/2010 15:46:02 helpd[2050] Delayed search for query: "support"
10/03/2010 15:46:02 helpd[2050] Starting help articles search for query: "support"
10/03/2010 15:46:02 helpd[2050] Query 289928762.026442 returned results: (
)
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] Query finished: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> finished query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> has results: {
}
10/03/2010 15:46:02 HelpViewer[2049]    Found no results for support

如何在Snow Leopard帮助包中正确使用帮助:URL? (毋庸置疑,我知道使用相对文件URL的解决方法,并且这有效,但我希望得到帮助锚点,以便在应用程序中进行上下文帮助和链接。)

2 个答案:

答案 0 :(得分:6)

事实证明这些锚点和URL是正确的,并且helpd会自动为内容编制索引,但它会维护一个积极的缓存。如果更新了帮助手册而没有碰到版本号,则它不会扫描新的锚点。

rm -rf ~/Library/Caches/com.apple.help*
killall helpd

答案 1 :(得分:0)

您是否使用帮助索引器实用程序首选项中选择的锚索引编制了帮助手册? 好像锚而不是索引...

当然我也会检查我的主播名字,但是在做完或说出来后10分钟我忘记了...