If this is the case: - I am using storyboard - core data - xcode 4.6
For a specific view in my app, UITableViewController uses that view, if the user clicks on a button, then the software goes to some processes where data is downloaded from the Internet API and saved in core data. I believe this is a resource, so I am trying to complete those processes in separate threads.
Note: - The order of operations is because the legs are dependent on exchanges. Exchanges are dependent on the race and the situation depending on the race. Otherwise I would execute everything in asynchronous manner.
Issues: - This is my first time working with the Grand Central Dispatch. I'm not sure I'm doing it correctly - if I inform of data processing then UIProgressView is visible and updates as expected
The way to manage downloads and progress down is.
- (IBAction) Download Now: (ID) Sender { [Set progress view: No]; [Progress Set Progress: Animated 0.1: Yes]; Sender_synccc (background qiu, ^ (zero) {[auto save]; [auto update progress: 0.2];}); Sending_season (background qiu, ^ (zero) {[save yourself]; [auto update progress: 0.3];}); Sender_sisk (Background Que, ^ (Zero) {[Self Download Exchange]; [Self Save Exchange]; [Self Update Progress: 0.4];}); Sender_sisk (Background Que, ^ (Zero) {[Self Download Leggs]; [Self Levels]; [Auto Update Progress: 0.5];}); Sender_sisk (background que, ^ (zero) {utilities * utilities = [[utilities light] init] [utilities countdown start times: with race: managed object contaxes]; [auto update progress: 1.0];}); }
- (void) Update progress: (double) full percent {if (absolute percentage = 1.0) {[auto goHome]; } And if ([count of import imports]> gt;) {[progress set progress: full animated percentage: yes];
Any help is greatly appreciated.
The method will block the dispatch_sync calling thread, which I believe is the main thread in your case, It seems that it is better to wrap those Dispatch_SDI blocks in a transmission_social block.
As an example:
Sender_Associate (background que, ^ (zero) {[self-saving]; [Self update progress: 0.2]; [protect yourself [Self updating progress: [self exchange]; [Exchange self-saving]; [Self updating progress: 0.4]; [Self download legs]; [Self-saving progress]; [Self update progress: 0.5]; Utilities * Utilities = [[UtilitiesAbol] init]; [Count of utilities Start Times: Run With: Managed ObjectTontx]; [Self Update Progress: 1.0];}); After that you can wrap the progress to update the main thread because it has a UI update.
- (zero) Update progress: (Double) Percent completed {if (full percentage == 1.0) {[Self-Gogh]; } And if ([counting of import imports]> gt;) {sender_ascientific (send_pot_main_close ()), ^ {[progress-scene set progress: fully animated animation: yes];}); }}
No comments:
Post a Comment