Max_B
Max_B

Reputation: 1027

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.

Upvotes: 8

Views: 491

Answers (1)

Max_B
Max_B

Reputation: 1027

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à.

Upvotes: 10

Related Questions