Re: NSNotifications & background apps?
Re: NSNotifications & background apps?
- Subject: Re: NSNotifications & background apps?
- From: dreamcat7 <email@hidden>
- Date: Sun, 15 Jun 2008 11:18:44 +0100
On 14 Jun 2008, at 22:27, Nathan Kinsinger wrote:
I haven't seen "Meow" but there is a Notification Watcher project
(with source) at:
http://www.tildesoft.com/Programs.html
It may do what you need, or you could extend it to do so.
--Nathan
- yes, thank you i have had a look. Its copyright of Tildesoft under
creative commons 1.0 liscence.
So i must attribude the following (1) line of sourcecode to Tildesoft
under the http://creativecommons.org/licenses/by/1.0/
And likely that the Meow tool did use this same method.
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(myNotificationHook:)
name:nil object:nil];
So if you put name = nil as the notification name then it will catch
*all* notification from the notification centre. Each notification can
then be appended to an NSArray by the notificationHook fn, along with
timestamp and any other relevant data (e.g. to know the application
that sent it or a 'threaded view').
- (void)myNotificationHook:(NSNotification*)aNotification
{
[self.nsNotificationArray addObject:aNotification];
[self.timestampFornsNotificationArray addObject:[NSCalendarDate date]];
}
And then watch the array with KVC/binding and all the notification
data can be printed to NSTableView or textual log. This can be simply
achieved with [object description] to print the NSString
representation of the @"name "@"object" and @"userInfo" parameters of
the NSNotification.
This would make for a really cool little project to do alongside the
Hillegass book.
_______________________________________________
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