nsnotifications

How do I make my NSNotification trigger a selector?

Here's the code: - (void)viewDidLoad { [super viewDidLoad]; NSURL *musicURL = [NSURL URLWithString:@"http://live-three2.dmd2.ch/buureradio/buureradio.m3u"]; if([musicURL scheme]) { MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:musicURL]; if (mp) { ...

Warning about duplicate NSNotification observations

This isn't a question so much as a warning to others to save them some time. NSNotificationCenter on iOS 3/iPhone OS 3 (I'm assuming also Mac OS X and iOS 4) has the following behavior: If you register yourself multiple times for the exact specific notification, NSNotificationCenter will NOT recognize the redundancy and instead will fi...

uiview and uiscrollview

hello everybody. i am creating a dropdown button in my app. Like a pop-up control which is available in webapps. so when i click on a button, a new uiview containing a pickerview appears. i user beginanimations and commitanimations for dispalying and hiding the uiview. the new uiview is half the size of the scrollview. I want that when...

NSNotificationCenter: pass Notification between 2 classes

i have 2 classes. class1 gets some information through the net. when one of these informations comes, class1 has to send a notification to class2. i understood it so that i have to put [[NSNotificationCenter defaultCenter] postNotificationName:at"anyUserNotification" object:class2]; into class1 [[NSNotificationCenter defaultCente...

NSNotification when device time changes (minutes) ?

Is there a way I can easily set up a notification when the minutes change on the system time for iOS devices? I need to do some UI updates for time changes. I'd like the UI to update exactly on minute changes, not just every 60 seconds through an NSTimer trigger. ...

Registering a bool for a NSNotification.

Hi everyone, I'm trying to wrap my head around NSNotification but can't seem to get it to work. Think I'm misunderstanding how to register for an notification. I have a bool as a property in my connection manager class. At initialisation I authenticate with a few servers and check if I can access an external URL (App will mainly be use...

How can I tell my app is about to become inactive/go to background state?

I am assuming I need to implement: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resignActive:) name:UIApplicationWillResignActiveNotification object:nil]; ...

appleevent versus notification

Hello, I am looking for a high performance inter process communication system in macos X. What is the best system? AppleEvents or NSNotifications? Thanks :) ...

Performance speed of KVO and NSNotifications?

Should I be afraid of using Key-Value Observations (KVO) and NSNotifications? I'm beginning to use them in my app, but I'm a little unfamiliar with the concept of something that could possibly be triggering an appwide call or automatically doing stuff, and a little afraid of the performance hit that such overhead could bring. Are my con...

How can i receive Notifications while a modal dialog is open.

I need to send messages to the GUI thread which should be processed the next time the GUI thread is idle. This message can come from the GUI thread or background threads. I tried a combination of a MachPort/Notification. But when i do a [[NSNotificationQueue defaultQueue] enqueueNotification: my_notify postingStyle: NSPostASAP]; Thi...

Playing multimedia content in sequence

Hi I have an NSArray containing many 'multimedia action' as I like to call them, objects that encapsulate some multimedia content like movies and photos. I'd like to 'play' them in sequence waiting each one finished before calling the other. What is the best way to manage the duration of each operation before calling the next one? (for ...

Managing NSNotification along with UITabBarController interactions

I have 1 main UIViewController that contains a UITabBarController. The tab bar controller has 4 UIViewControllers (each managed by UINavigationControllers). Succinctly, it looks like this: MainViewController | |--- FirstUIViewController | |--- SecondUIViewController | |--- ThirdUIViewController | |--- FourthUIVi...

Should I test a model class which sync often to the server?

And how do I do it, since obviously there are a lot of async methods, and no way (that I know of) to check them in a unit test. For example: - (void) testSomeTest { // things [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(helperTestSomeTest:) name:connectionFinished object:nil]; // connect to server } - (void)...

Refresh view controller content on app entering foreground

I have an app with a tab bar that has a few tabs with user-generated content. When each view controller loads, the viewDidLoad method makes HTTP requests to a server to fetch data, then populates its view correspondingly. Once all the data is loaded, however, the view remains the same (unless the view controller is unloaded and reloaded)...

NSNotificationCenter trapping and tracing all NSNotifications

For some better understanding on what happens “under the hood”, I would love to do a complete trace of any notifications happening within my application. Naïve as I am, the first thing I tried was registering like this: Somewhere in my app: { [...] [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(trac...

Objective C - How to access NSNotification inner objects?

I want to access a inner object from a notification. I need to get the key AVSystemController_AudioVolumeChangeReasonNotificationParameter. If I call [sender object] I get this output. But if I call [[sender object] userInfo] I only get "unrecognized selector sent to instance". Why is that? NSLog(@"%@", [sender object]) output: NS...

registering for NSNotification crashing my application??

i am playing a movie using MPMovieplayerViewController and i want to register for notifications when the movie stops...i am using the following code to use NSNotification but my application is crashing when the movie stops...i have used the NSNotification in same way earlier when it executed fine.. any idea regarding what i am doing wron...

NSNotificationCenter: How long does it take to perform an operation

I want to know how long does it take from posting a notification to getting the notification. The reason is that I want to find out if the observer pattern is suitable for me. I don't want that another view controller can change the value before the notification has been sent and processed. I'm afraid that another process (thread?) is f...