I've been having some trouble with Snow Leopard's new block-based API for observing notifications from NSWorkspace's NSNotificationCenter.
If I register for notifications using the traditional selector-based method, then I am able to observe the desired notification. If I try using the new method that takes a block, then it doesn't work...
Hi,
I need to move UI elements of my view controller when keyboard appears. I do this by registering for the keyboard notifications in my app delegate:
[[NSNotificationCenter defaultCenter] addObserver:observer
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NS...
I'm going to be using NSNotifications in my app to decouple the code.
I want the compiler to help me when using strings as the names of the notifications, ie, if I mistype one, I want the compiler to tell me.
Using normal strings for this won't work, because the compiler won't know that if I typed "myNotificaion" that I really meant "m...
I have a MainViewController in my Cocoa Touch app which shows a status view containing a UIProgressBar view.
From the MainViewController, FlickrImage model objects are created and iterated over. the FlickrImage objects themselves interact with the Flickr API, which takes time which is why I want the user see the progress bar. The challe...
What are the pros and cons of each of them?
Where should I use them specifically?
...
I am trying to perform an operation on a background thread. In the past i have used
[self performSelectorInBackground: @selector (getSetDisplay) withObject: nil];
to accomplish this. However, I have registered for this function to be executed within an NSNotification and I need to animate the UIActivityIndicator. The UIActivityIndic...
Hello,
I have always wondered why is it necessary to unregister your nsnotifications in the application will terminate method. I know that nothing that I can notice happens if I don't, so what are the implications of not doing so?. Any help will be greatly appreciated.
Thank you.
-Oscar
...
Hello,
I'm using the XMLRPC framework (by Eric Czarny) for iPhone to communicate with my server. I am using the XMLRPCConnection class (which is basically an extension of NSURLConnection) to create asynchrnous HTTP requests to fetch my data. The connectionDidFinishLoading method sends one and the same NSNotification each time data has b...
I have a custom uitableviewcell. It has a uitextfield. I'd like the parent tableview controller to take action when the uitextfield keyboard return key is pressed. How do I get the notification to the parent tableview without creating an app wide event notification? Or, is that the best way?
...
I am trying to debug a very nefarious problem with some iPhone Core Data code.
The setup is this: I have a thread which exists to poll a web service and send its results via NSNotification to the main thread (passed in the userDict, a bunch of strings and NSNumbers). I'm using Tim Hatcher's notification library to pass to the main threa...
Hi,
I created a program to send and receive events through NSNotification. Now i need to send data along with the event. Can anyone suggest me how to do this in coding in Objective-C??
...
I have a fairly complex iphone application that has many asynchronous processes occurring. To deal with this I'm making heavy use of NSNotification Center. My question is what is the "best practice", if such a thing exists", for registering the notifications? Right now they sprinkled through my code in a hap-hazard way. I'm about to ...
I have an iPhone application which basically is getting information from an API (in XML, but maybe JSON eventually). The result objects are typically displayed in view controllers (tables mainly).
Here is the architecture right now.
I have NSOperation classes which fetch the different objects from the remote server. Each of these NSOpe...
Are there any race condition issues when using NSNotifications within a single thread? Here is a sample method:
- (void) playerToggled: (NSNotification *) notification {
if (timerPane.playing && ! timerPane.paused) {
[playerPane toggleCurrentPlayer];
[timerPane toggleTimer];
[mainPane playerToggled];
}
}
The first two ca...
I'm trying to get the notification NSTaskDidTerminateNotification in my multithreaded app but I can't get it working. It does seem to work when I tested it on a single threaded app. In init I have [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(taskDidEnd:) name: NSTaskDidTerminateNotification object: myTask];...
Hi,
In my NSApp delegate I add an observer of an object that is an NSWindow subclass that gets initiated in the delegate itself and that posts a notification once the window gets clicked. The selector is also in the delegate. From that same delegate class I initiate another object which when initiated adds itself as an observer for anot...
A simplification...
A building has an array of apartment objects. Each apartment has a single currentTenant. These tenants are of type Person. Note that currentTenant doesn't have a reference to the apartment, so can't send information back up the chain.
When a tenant has a plumbing issue he raises an NSNotification:
[nc postNotifi...
Hi everyone,
I have a tabBarController set up in the AppDelegate and have a few UIViewControllers with Nav Controllers. In one of the TabBar items, after I have pushed a few UIViews I want to update the badgeValue item of a different TabBar item.
Whats the best way to do this? The only way I can really think is a NSNotification and a s...
I simply need to have a notification post when a valid IP address is assigned. I have tried polling via SCReachability, but that seems to be inefficient.
Any suggestions? This seems like it should be simple, but I've been struggling for several hours to get anything working.
...
I have create a class MyConnection that extends NSURLConnection. I have implemented some delegate methods. I am able to print the data received from the URL call. However when I pass the MyConnection instance into MyHelper class, I do not get the data received in the MyConnection class. I tried putting a sleep call between the two task a...