• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem sending notification from C callback function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem sending notification from C callback function


  • Subject: Problem sending notification from C callback function
  • From: Sandro Noel <email@hidden>
  • Date: Thu, 08 Jan 2009 20:57:32 -0500

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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Problem sending notification from C callback function
      • From: Ken Thomases <email@hidden>
    • Re: Problem sending notification from C callback function
      • From: "Sean McBride" <email@hidden>
  • Prev by Date: Re: Best way to handle this
  • Next by Date: Re: Resetting the TableView
  • Previous by thread: Re: Resetting the TableView
  • Next by thread: Re: Problem sending notification from C callback function
  • Index(es):
    • Date
    • Thread