Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working on a bug at work. The app is written in Objective-C for iOS based device, for the iPad. I'm the new guy there and I've been given a hard task. Sometimes, the UIButton text property does not show the correct state when syncing. Basically, when the app is syncing, my UI control would say "Syncing" and when its not syncing it'll display "Updated @ [specific date]". Right now there is a property on the app delegate called "SyncInProgress". When querying / syncing, occurring on background thread, it updates a counter. The property will return a bool checking expression 'counter > 0'.

There are three states I need to deal with. Sync has started. Sync is updating tables. Sync finished.

These items need to occur in order.

My coworker suggested to take a state based approach instead of just responding to events. I'm not sure about how to go about that.

Would it be best to have the UI receive a notification to determine what state its in or to pull every so often if state changed?

Here are two posts that I put on stackoverflow, in the last few days, that relate to this.

Any ideas that anyone might have to very much appreciated.



share|improve this question

If you're downloading the data for syncing using something like NSURLConnection, there are delegate call backs for when the connection is made (sync started), data is being downloaded (syncing) and data has finished downloading (sync finished). Even if you're not using NSURLConnection, specifically, most asynchronous web connection frameworks have this same sort of delegation pattern.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.