Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

2002cbr600f4i

macrumors 6502
Original poster
Jun 21, 2008
489
0
HEy gang...

Ok, my app is designed where I'm receiving a streaming data feed from a server. That code was designed to work similarly to the Network code in the WiTest example... I get the data, parse the XML, stuff the elements into a NSDictionary, and then pass it off to a "dataController" class I made.

When the method is called to push the data into the dataController, I have the dataController pushing out a NSNotification message.

I have UIPickerView controls on 2 different views that receive that update notification, and go out and ask the dataController for all the keys and then populates/repopulates the picker list with those keys. If there's nothing in the list, it adds the elements and selects the first item in the list, which then asks the dataController for that entry's data dictionary of data elements and displays them on the screen. If the list already had data, it just updates the list, and if the previously selected item is still in the list, it loads the new data, if not, it just keeps whatever was on the screen there.

The problem I'm running into is (usually only in this case) if the list is empty and I send in 1 data element, I'll see it show up in the list, the data will come in and populate the fields, but if I interact with the Picker at all, it will totally lock the UI until another data element is brought in by the network connection. After that it'll be fine.

I just can't seem to figure out what's happening and what's causing the issue. It SEEMS like a deadlock, but I'm not spawning any threads. And it also seems strange that it only happens (usually) on the first data element.

The network connection will sit there and keep chugging along, but unless I get a message that should be forcing an update of the dataController (and in turn the Pickers) I'm stuck UI wise...

Any ideas???
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
It sounds like you are running your networking in the main thread. If this is synchronous and blocks whilst it is running your entire UI will become unresponsive as the handlers for it are run in the main thread too. Either use async networking or run it in another thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.