Today at work, I was given a task to fix a bug within our iPad application that we are developing. The issue relates to information updates not displaying correctly about syncing between the app and the web service or the inconsistencies of the app not syncing at the times it should and thus the information displayed, in the UIButton, being incorrect. The querying of the web service to get updated data and other meta information occurs on several subclassed NSOperation classes. The information updates, when some event finishes or what not in the NSOperation subclass, posts a notification using notification center by adding an operation with block on the main queue of the NSOperationQueue. The syncing occurs when the app first loads and every five minutes. If the five minute mark occurs while the app is in the background, the sync occurs once the app comes back to the foreground.
When our inbox view controller is allocated and the view will appear, UIButton doesn’t show that syncing is in progress but one can tap on the button to begin a sync. In the inbox view controller on the view will appear method, the code does a check if syncInProgress. There are several edge cases where this check fails; well, as far as I can tell based on what I understand of my task and the code base that I’ve been figure out so far.
- (BOOL) syncInProgress {
return _serviceCounter > 0;
}
At the bottom, of the description of the bug it, perhaps take a state approach vs just responding to events. Not sure that that means.
Yes its very simple, iOS provides a way to check for a change in state on an element, and when this occurs a method object or something can be notified.
Key Value Coding
If this is not what you mean please feel free to specify.