last day (15 days later) » 

9:42 PM
0
A: Wait for Xcode method to Finish

FogmeisterThe two approaches I would consider first are NSOperationQueue (you can detect when it's empty) or the easier choice of using the Bolts framework. Bolts allows you to create an array of tasks that all run asynchronously and then once they're finished it goes on to the next bit. Let me get a lin...

 
Thanks for post, I wasn't down vote btw, but would you elaborate more about how to use bolts
 
Check the GitHub link. I'm on my phone atm so can't do code very well. The section in the read me is called "Tasks in Parallel". It will show you how to create an array of tasks and then have a single completion handler once that entire array has finished processing.
Could the down voter please leave a comment to explain why my answer is incorrect? Or are they just being cowardly?
@iqueqiorio ok, on my laptop now. Let me show a quick example...
@iqueqiorio edited now.
 
Great, this looks awesome I will give it a try, one last thing is I am a bit confused on how to add it to my Xcode project, the installation instructions aren't clear, could you tell me?
 
@iqueqiorio go to cocoapods.org and have a look at installing that. It is much much easier and once you have it working you can use it for all projects in the future. The bolts framework is available through cocoa pods too.
 
I think I installed it what do I import to use Bolts?
 
9:42 PM
Have a read of the cocoapods instructions. Once you understand it you just search for "bolts" framework and click the clipboard button to copy the text for you Podfile. Using frameworks can be complicated the first time so take your time to ready the cocoapods stuff and learn it so you know for next time.
Also, there are tons of SO questions about using cocoapods.
 
Great I got it, the last thing I added an edit to the question if you would mind taking a look, Thanks
 
I don't really understand the question. Your task method should only create one image at a time. So each BFTask creates a single image. You then create multiple tasks. So that when they have all finished running then you will have multiple images. Split out your code for creating a single image.
Also, don't copy and paste my method name. It was just an example, you need to use a method name that is relevant to you.
 
Okay I made my own, and when I go to set .result of the completionSource varible
there is no property of result on completionSOurce
 
10:12 PM
I'm going to come back to this tomorrow. It's late now and I need to go to bed. Can you create a gist.github.com of your code so I can take a look. I'll update it so that it works with bolts. (tomorrow)
 
Okay I got it now the
but at the end of this
[[BFTask taskForCompletionOfAllTasks:tasks] continueWithBlock:^id(BFTask *task){
// this code will only run once all the images are created.
// in here self.imageArray is populated with all the images.
}
I get control reaches end of non void, what should it return there?
 
return nil
 
The whole bolts framework is really powerful for asynchronous stuff. It can do a lot more than what you have done here. It's worth learning about it.
 

last day (15 days later) »