I've just finished implementing a Help book in my app, which works like a charm when run from Help > Search, and Help > MyApp Help in the toolbar.
However, I want to be able to call the Help-docs from within the app, and for this I used NSHelpManagerpenHelpAnchor:inBook which should be as easy as follows:
In one of my pages in the help docs I insert the following somewhere in the body:
Upon calling the code, however, the help-window opens but I am greeted with the following alert:
"Help Viewer cannot open this content."
I've double-checked the name of both the anchor and the Help book and they are correct. I don't really know where to look for other potential causes for this error and documentation of this function is no help here. Any ideas?
[ EDIT 1 ]
The findString-function will work, but instead of jumping directly to the right passage it lists the page with the string in the index. Not as smooth as the openHelpAnchor is supposed to...
This also leads me to believe that the problem for openHelpAnchor relates to the syntax of my anchor. So I've tried setting both id and name in the anchor to "testanchor", but without success.
[ EDIT 2 ]
I forgot to mention that you will need to tick the "Index anchor information in all files"-box in the Help Indexer for all the anchors to be indexed and accessible. Still no luck with my app, though, so I'll continue my search.
[ EDIT 3 ]
Here's the actual doc for clues. It is located one folder below the index.html in folder "pgs".
MyApp Help/pgs/navigation.html
MyApp Help/index.html
However, I want to be able to call the Help-docs from within the app, and for this I used NSHelpManagerpenHelpAnchor:inBook which should be as easy as follows:
Code:
[[NSHelpManager sharedHelpManager] openHelpAnchor:@"testanchor" inBook:@"MyApp Help"];
In one of my pages in the help docs I insert the following somewhere in the body:
Code:
<a name="testanchor"></a>
Upon calling the code, however, the help-window opens but I am greeted with the following alert:
"Help Viewer cannot open this content."
I've double-checked the name of both the anchor and the Help book and they are correct. I don't really know where to look for other potential causes for this error and documentation of this function is no help here. Any ideas?
[ EDIT 1 ]
The findString-function will work, but instead of jumping directly to the right passage it lists the page with the string in the index. Not as smooth as the openHelpAnchor is supposed to...
This also leads me to believe that the problem for openHelpAnchor relates to the syntax of my anchor. So I've tried setting both id and name in the anchor to "testanchor", but without success.
[ EDIT 2 ]
I forgot to mention that you will need to tick the "Index anchor information in all files"-box in the Help Indexer for all the anchors to be indexed and accessible. Still no luck with my app, though, so I'll continue my search.
[ EDIT 3 ]
Here's the actual doc for clues. It is located one folder below the index.html in folder "pgs".
MyApp Help/pgs/navigation.html
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!-- TITLE + KEYWORDS + DESCRIPTION (EDIT) -->
<title>Navigation</title>
<meta name="keywords" content="navigation, navigating, go forward, go back"/>
<meta name="description" content="Learn how to navigate."/>
<!-- Needed for anchors to be indexed -->
<meta name="robots" content="anchors"/>
<link href="../sty/task.css" rel="stylesheet" type="text/css" media="all"/>
</head>
<body id="apple-pd">
....
<!-- ANCHOR -->
<a name="testanchor"></a>
....
</body>
</html>
MyApp Help/index.html
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MyApp Help</title>
<meta name="AppleTitle" content="MyApp Help" />
<meta name="AppleIcon" content="MyApp Help/gfx/APPL.icns" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="robots" content="anchors"/>
<link href="sty/home_os.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body id="apple-pd">
.....
</body>
</html>
Last edited: