sch*_*udu 5 cocoa xcode4 apple-help help-viewer
我已经仔细检查了一切,并希望有人能找到一个我没见过的愚蠢的错误.
我正在尝试为我的应用程序构建Apple帮助部分,它正确地转到登录页面,但没有任何锚点工作.调用登录页面并调用位于目录中index.html的另一个页面. test.htmlpgs
在index.html我有:
<a href="help:anchor=support bookID=com.company.app_name.help">Link to another page</a>
Run Code Online (Sandbox Code Playgroud)
在test.html我有:
<a name="support"></a>
Run Code Online (Sandbox Code Playgroud)
所以这是我为了到达现在的位置而遵循的步骤:
1)我构建了Apple文档指定的目录
AppName.help/
Contents/
Info.plist
Resources/
shrd/
English.lproj/
index.html
search.helpindex
pgs/
test.html
Run Code Online (Sandbox Code Playgroud)
2)我按照Apple文档中的规定构建了Help Info.plist.包含在我设置的Info.plist CFBundleIdentifier中com.company.app_name.help.
3)在我的应用程序Info.plist中,我将设置CFBundleHelpBookFolder为AppName.help并设置CFBundleHelpBookName为com.company.app_name.help
4)然后我将我内置的目录复制到Xcode中,同时确保为任何添加的文件夹选择了Create Folder References选项.
5)然后我使用Help Indexer索引目录AppName.help.确保我选择了在所有文件中索引锚信息的选项.然后将.helpindex文件复制到应该是的English.lproj文件夹中.
而已.如果我在index.html文件中放置以下链接它可以正常工作,我注意到有关我的应用程序的一些事情.
<a href="pgs/test.html">Click this link</a>
Run Code Online (Sandbox Code Playgroud)
这也是我的index.html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AppName Help</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex" />
<meta name="AppleTitle" content="AppName Help" />
<meta name="AppleIcon" content="../shrd/icon.png" />
</head>
<body>
<a href="help:anchor=support bookID=com.company.app_name.help">Link to another page</a>
</body>
Run Code Online (Sandbox Code Playgroud)
这是test.html的代码.
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing Links</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="anchors" />
</head>
<body>
<a name="support"></a>Does linking work?<br/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的帮助文件的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>CFBundleDevelopmentRegion</key>
<string>en_us</string>
<key>CFBundleIdentifier</key>
<string>com.company.app_name.help</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AppName</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>2</string>
<key>CFBundleSignature</key>
<string>hbwr</string>
<key>CFBundleVersion</key>
<string>2</string>
<key>CFBundleHelpBookName</key>
<string>AppName Help</string>
<key>HPDBookAccessPath</key>
<string>index.html</string>
<key>HPDBookIconPath</key>
<string>shrd/icon.png</string>
<key>HPDBookIndexPath</key>
<string>search.helpindex</string>
<key>HPDBookKBProduct</key>
<string>app_name1</string>
<key>HPDBookKBURL</key>
<string>http://www.company.com</string>
<key>HPDBookRemoteURL</key>
<string>http://www.company.com</string>
<key>HPDBookTitle</key>
<string>AppName Help</string>
<key>HPDBookType</key>
<string>3</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
我也跟着这篇文章:http://www.cocoabuilder.com/archive/cocoa/312037-updating-an-app-help.html除了重新索引目录之外每次进行更改时清除缓存.
谢谢大家!
当然大卫,谢谢你的提醒.
根据我的记忆和我的草率文档,我运行以下命令来索引帮助文档文件:
hiutil -vCaf ./search.helpindex English.lproj
Run Code Online (Sandbox Code Playgroud)
然而,我意识到的一件事是索引实用程序会在任何时候使用该 字符时抱怨.而是替换角色 
我认为那是我案例中的错误.