I need to unmount a USB device within Objective-C in a sandbox application.
For unmount I use:
DASessionRef session = DASessionCreate(kCFAllocatorDefault);
DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
DADiskRef disk = DADiskCreateFromBSDName(kCFAllocatorSystemDefault, session, bsdName);
DADiskUnmount((DADiskRef) disk, (DADiskUnmountOptions)kDiskUnmountOptionDefault, DiskUnmountCallback, NULL);
from DiskArbitration.
All works fine until I activate sandboxing. With sandboxing the unmount (DiskUnmountCallback) returns a failure.
I can not find out the sandbox entitlement settings for device unmount nor any other reason for that problem.
In the entitlement I activated "com.apple.security.device.usb" but I still can not unmount the USB device.