Launch Service API failure with specific UTI

The launch service API LSSetDefaultRoleHandlerForContentType fails with -54 error when used UTI as "public.html".

However it works well with rest of the UTI types xml, rtf, text ,xhtml etc. The OS X tested with was 10.11 an 10.10. The application from whether this API was executed was NOT sandboxed. Same result when exeucted with root context.

Console error message "Unentitled request to set default handler for content type public.html by pid "

Could you throw some light on the possible causes why API should fail for html uti type.

Thanks,

Rupesh

Any guess why launch service API is failing for html UTI?

In this context error -54 is

permErr
, indicating that you’re hitting a deliberate restriction.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello eskimo,


Since this default role handler for 'public.html' UTI can be changed by the user by the 'Get info' right-click menu without the changing the default browser, may I ask why 'public.html' default role handler can't be modified programmatically ?


By the way, this is the kind of thing should definitely be in the documentation...


Cheers,
t.rebours.

Since this default role handler for 'public.html' UTI can be changed by the user by the 'Get info' right-click menu without the changing the default browser, may I ask why 'public.html' default role handler can't be modified programmatically ?

Given the error code returned I believe that this a deliberate security restriction but I can’t give you definitive answer as to why that is because, as you say, it’s not officially documented. You should definitely file a bug against the doc asking for clarification here.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Launch Service API failure with specific UTI
 
 
Q