Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate working indexes for MacOS Help on Mojave and Catalina

This is an "answer you own question" contribution.

I have been struggling for a day trying to get anchor to work in NSHelpManager system on 10.15, in order to be able to open a given help page with the openHelpAnchor:inBook: method.

Apple documentation for help system is old and have not been updated for a while. The hiutil man page give a hint, stating :

Spotlight help indices are required in macOS Mojave or later.

But using any of the two formats available did not work by itself.

So I had to reverse engineer by browsing the help ressources of Xcode itself to find the solution.

like image 983
Max_B Avatar asked Feb 23 '20 20:02

Max_B


1 Answers

The trick is to generate two index files, one for each format, into the .lprojfolder :

hiutil -I corespotlight -Cf help.cshelpindex -a -s fr -l fr .
hiutil -I lsm -Cf help.helpindex -a -s fr -l fr .

Then, and this is the undocumented key, one needs to add an entry into the help info.plist :

<key>HPDBookCSIndexPath</key>
<string>help.cshelpindex</string>

along with the traditional documented HPDBookIndexPath entry.

Et voilà.

like image 83
Max_B Avatar answered Nov 05 '22 07:11

Max_B