Greetings.

I'm having a little problem due to lack of knowledge here.

I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.

the callback is registered like this.
daSession  = DASessionCreate(kCFAllocatorSystemDefault);                
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop currentRunLoop] getCFRunLoop], kCFRunLoopCommonModes); DARegisterDiskDisappearedCallback(daSession, NULL, &DiskDisappearedCallback, (void *)self);


the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
        CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
        NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;
        
        NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
        NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
        NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"];     

[[NSNotificationCenter defaultCenter] postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];
}

Obviously, default center does not exist in the callback, but i cant seem to typecast the context to my object type and retrieve the notification center from the object. i just do not know how to do it.

could someone enlighten me please ?

thank you Sandro Noel.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to