title: Apple Help Authoring
body: <p>I'm following <a href="http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/authoring_help/authoring_help_book.html#//apple_ref/doc/uid/TP30000903-CH206-CIHEAADH" rel="nofollow">this guide</a> 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 <code>NSHelpManager</code> will open the help viewer but bring back a page not found.</p>
  
  <p>Things to check off the list:</p>
  
  <ol>
  <li>There is an anchor with the correct name at the top of the page</li>
  <li>The folder structure is a replica of what is in that article linked earlier</li>
  <li>We are re-indexing the help pages</li>
  <li>We do clear out all of the caches</li>
  </ol>
  
  <p>Here's the code we use to open the help page:</p>
  
  <pre><code>NSString *locBookName = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleHelpBookName"];
  [[NSHelpManager sharedHelpManager] openHelpAnchor:@"mypage" inBook:locBookName];
  </code></pre>
  
  <p>In this instance we'd have a page with a <code>&lt;a name="mypage"&gt;&lt;/a&gt;</code> at the top so it should link correctly. Our scripts are as follows:</p>
  
  <p>hvfix (clears all caches):</p>
  
  <pre><code>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
  </code></pre>
  
  <p>updatehelpindex.sh (re-generates indexes)</p>
  
  <pre><code>#!/bin/sh
  hiutil -C -f MyApp.help/Contents/Resources/English.lproj/MyApp.helpindex
  MyApp.help/Contents/Resources/English.lproj/
  </code></pre>
  
  <p>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 <code>NSHelpManager</code> 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).</p>
  
  <p>Ideas?</p>
  
  <p><strong>EDIT (folder structure):</strong></p>
  
  <p>This is within the MyProj.help folder that's in a sub-directory of the overall Cocoa project called 'help'.</p>
  
  <pre><code>+ Contents
       Info.plist
       + Resources
           + shrd
                (a bunch of image files)
           + English.lproj
                 MyProj.helpindex
                 index.html
                 + css
                 + pgs
                 + gfx
  </code></pre>
  
  <p>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.</p>