Apple 帮助创作 [英] Apple Help Authoring

查看:62
本文介绍了Apple 帮助创作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 本指南 公开一些 Apple 帮助.我工作的应用程序已经内置了多年的帮助,但它突然停止工作,并且没有对应用程序 plist 或任何帮助文件进行任何更改.我们假设 Apple 改变了一些东西,所以我确保它符合 Apple 要求的规格.当我说不工作"时,我的意思是我们使用 NSHelpManager 的链接将打开帮助查看器,但会返回一个未找到的页面.

I'm following this guide to public some Apple help. The application I work on has had help built in for years, but it stopped working all of a sudden, and no changes were made to the application plist or any of the help files. We're presuming Apple changed something, so I made sure it met the specifications Apple were requiring. When I say "not working" I mean that our links using NSHelpManager will open the help viewer but bring back a page not found.

要从清单上核对的事项:

Things to check off the list:

  1. 页面顶部有一个具有正确名称的锚点
  2. 文件夹结构是之前链接的那篇文章中内容的副本
  3. 我们正在重新索引帮助页面
  4. 我们确实清除了所有缓存

这是我们用来打开帮助页面的代码:

Here's the code we use to open the help page:

NSString *locBookName = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleHelpBookName"];
[[NSHelpManager sharedHelpManager] openHelpAnchor:@"mypage" inBook:locBookName];

在这种情况下,我们将有一个页面顶部带有 </a> 以便它应该正确链接.我们的脚本如下:

In this instance we'd have a page with a <a name="mypage"></a> at the top so it should link correctly. Our scripts are as follows:

hvfix(清除所有缓存):

hvfix (clears all caches):

rm -rf ~/Library/Caches/com.apple.help*
rm -rf ~/Library/Preferences/com.apple.help*
rm -rf ~/.Trash/*
killall helpd
defaults write com.apple.helpindexer IndexAnchors YES

updatehelpindex.sh(重新生成索引)

updatehelpindex.sh (re-generates indexes)

#!/bin/sh
hiutil -C -f MyApp.help/Contents/Resources/English.lproj/MyApp.helpindex
MyApp.help/Contents/Resources/English.lproj/

我们进行构建,将文件夹放入 Applications 文件夹以注册应用程序 + 帮助.我们甚至尝试重新启动或注销/登录,但仍然一无所获.我知道这是一个非常繁琐的过程,但我们尝试的任何方法似乎都不起作用.我们想要做的就是使用 NSHelpManager 打开一个帮助锚点.毫无疑问,这在 10.6+ 中有效,因为许多其他应用程序都这样做(一些报告表明它在 10.7/8 中不起作用,但它们肯定是不真实的).

We do a build, drop the folder into the Applications folder in order to register the application + the help. We even try a restart or logoff/logon and still we get nothing. I know it's a very fiddly process but nothing we try seems to work. All we want to be able to do is use the NSHelpManager to open a help anchor. Undoubtedly this works in 10.6+ as so many other apps do it (some reports suggest it won't work in 10.7/8, but they must be untrue).

想法?

编辑(文件夹结构):

这在 MyProj.help 文件夹中,该文件夹位于整个 Cocoa 项目的子目录中,名为help".

This is within the MyProj.help folder that's in a sub-directory of the overall Cocoa project called 'help'.

+ Contents
     Info.plist
     + Resources
         + shrd
              (a bunch of image files)
         + English.lproj
               MyProj.helpindex
               index.html
               + css
               + pgs
               + gfx

文件夹中的内容正是预期的内容,css"中有一堆 CSS 文件,pgs"中有 HTML 页面,gfx"中有图像文件.

And in the folders are precisely what's as expected, 'css' has a bunch of CSS files in it, 'pgs' has the HTML pages and 'gfx' has image files.

推荐答案

好的,这个问题就像过山车一样混乱,但它与您在 Xcode 中设置的文件夹结构有关.以下是一些值得了解的事情:

OK, this one's been quite a roller-coaster of confusion but it has something to do with with your folder structure setup in Xcode. Here's some things worth knowing:

  • 人们选择将其放在 English.lproj 中.不要这样做,有几个原因.首先,如果您将帮助文件夹拖到文件列表中,它不会在 Xcode 中显示子目录/文件,其次,该文件夹中的内容应该是平面的,而不是结构化的.
  • 在根目录中创建一个帮助"文件夹并将您的文件放入其中.如果需要本地化,您可以将它们放在名为English.lproj"的子目录中.
  • 不要创建包含所有帮助文件的.help"文件夹.这似乎破坏了索引.我们不知道为什么.
  • 相反,拥有/help/Contents/stuff 并将该文件夹拖放到您的项目目录列表中(我的在资源"组中).确保它是一个蓝色文件夹,并且您可以看到整个目录(所有 HTML 等)
  • 针对它运行帮助索引器以生成 .helpindex 文件
  • 确保您的 plist 条目反映该文件夹的名称以及您的 index.html 文件中指定的元标记名称

如果您遵循上述规则,事情应该可以正常工作.似乎在 ML 中创建 .help 文件夹会破坏一切,所以基本上,不要遵循 Apple 指南.

If you follow the above rules things should work fine. It seems in ML that creating a .help folder breaks things from here on out, so basically, don't follow the Apple guide.

这篇关于Apple 帮助创作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆