I have DADiskRef of drive, i want to mount it programmatically in cocoa. Here is code i have try to mount drive.
NSString *diskName=[dic valueForKey:@"DAMediaBSDName"]; // i.e. disk1s2
DASessionRef session = DASessionCreate(kCFAllocatorDefault);
DADiskRef diskRef= DADiskCreateFromBSDName ( kCFAllocatorDefault, session, [diskName UTF8String]);
DADiskMountWithArguments( diskRef,NULL,kDADiskMountOptionDefault,OnDiskMount,NULL,NULL);
// DADiskMount();
Here OnDiskMount is implemented below
static void OnDiskMount( DADiskRef disk, DADissenterRef dissenter, void * context )
{
if (dissenter)
{
// Error in mounting
}
else
{
// success
}
}
However this code working perfectly with 10.9 but getting issue while code signing is ON in 10.10.