Executing the default handler for OSX 10.10 with sandboxing enabled

I couldn't find anything online, but LSSetDefaultHandlerForURLScheme will return -54 when sandboxing is enabled. I'm not sure if you need to enable permissions for this to work the same as without sandboxing.

To see it, create a new project with this in the appdelegate:

-(void)applicationWillFinishLaunching:(NSNotification *)notification {
    // Become default handler
    CFStringRef bundleID = (CFStringRef)CFBridgingRetain([[NSBundle mainBundle] bundleIdentifier]);
    OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("maxel"), bundleID);
    if (result != 0) {
        assert(0);
    }
}

      

It will work. Then turn on the sandbox. This will result in a -54 error.

Built on OSX 10.10 Yosemite. Does anyone else come across this?

+3


source to share


1 answer


According to Apple's developer forums, you can no longer do this in the sandbox - the behavior you see is expected. This really makes matters worse, as there is no alternative API to implement this functionality other than going outside the sandbox.



+2


source







All Articles