evanspa / GasJot-ios

Gas Jot iOS application.
1 stars 0 forks source link

Quick toggling back-and-forth to the Home screen causes data synchronization issues. #1

Closed evanspa closed 8 years ago

evanspa commented 8 years ago

When the Home screen's viewDidAppear is invoked, all data-loading operations occur on a background thread via GCD. When done, the charts are re-drawn on the main thread. The various data sets that back the charts are held in NSMutableArray objects. In viewDidAppear, functions are kicked-off in background threads to clear the arrays, pull data from the local SQLite instance, and re-populate the arrays. The problem arises when the user quickly and repeatedly toggles back-and-forth to the Home screen. These 3 steps are occurring in multiple-executing threads and the data in those arrays are sometimes not consistent.

evanspa commented 8 years ago

The solution will be to leverage a serial queue for doing the background computations. This will ensure that the steps: (1) clear arrays (2) load/compute from SQLite (3) populate arrays, will always in occur in this order.

evanspa commented 8 years ago

Fixed in master and will appear in 1.4.1 release.