FROM : Sandro Noel
DATE : Fri Jan 09 02:57:32 2009
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.
DATE : Fri Jan 09 02:57:32 2009
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.
| Related mails | Author | Date |
|---|---|---|
| Sandro Noel | Jan 9, 02:57 | |
| Sean McBride | Jan 9, 03:45 | |
| Ken Thomases | Jan 9, 08:09 | |
| Sandro Noel | Jan 9, 16:17 |






Cocoa mail archive

