Sandboxed application cannot register Apple Help Book

Originator:adamnhjl
Number:rdar://10934217 Date Originated:26-Feb-2012 02:48 PM
Status:Duplicate/9330882 Resolved:
Product:Mac OS X Product Version:10.8DP1/12A128p
Classification:Serious Bug Reproducible:Always
 
Summary: A sandboxed application cannot properly register Apple Help Book located in its own bundle or at other places to which it has access. The issue affect sandboxed applications both on Mac OS X 10.7.3 and 10.8DP1/12A128p.

Steps to Reproduce:

1. Create a sandboxed application "A.app", which contains a bundle "B.bundle" in its resources. The "B.bundle" bundle contains an Apple help book directory called "AppSandBoxTestHelp" for an Apple help book of the same name in its Resources directory and has correct Info.plist keys configured (CFBundleHelpBookName, CFBundleHelpBookFolder both set to "AppSandBoxTestHelp").

2. Add the following code to "A.app":

	FSRef		bundleRef;
    NSURL*		bundleURL	= [NSURL fileURLWithPath: [[NSBundle bundleForClass:[self class]] pathForResource:@"B" ofType:@"bundle" ]];
	if( ! bundleURL)
		NSLog(@"Cannot get bundle URL");
	
	if( ! CFURLGetFSRef( (__bridge CFURLRef) bundleURL, &bundleRef ) )
		NSLog(@"Cannot get bundle fsref");
	
	OSStatus err = AHRegisterHelpBook( &bundleRef );
	if(err != noErr)
		NSLog(@"AHRegisterHelpBook error %li.",(long)err);

	err = AHGotoPage((CFStringRef)@"AppSandBoxTestHelp", NULL, NULL);
	if(err != noErr){
		NSLog(@"AHGotoPage error %li.",(long)err);


Expected Results: Calls to AHRegisterHelpBook AHGotoPage should be successful and should result in opening the help book in the help viewer.

Actual Results: AHRegisterHelpBook() returns successfully but registers the helpbook only in the preferences file inside the sandboxed application's container.

Notes: This actually happens no matter where the help book is located. Unless the help book is registered automatically, a sandboxed application cannot register it: not even for viewing from within the sandboxed application, which does not make sense.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!