Let’s say I have a few addresses. I need to get the coordinates for each address in the cycle. But getting the coordinates for one address takes some time. How to get the coordinates asynchronously in one cycle?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can write a routine that geocodes a single address from a mutable array and then have it call itself to process the next one in the completion block. Thus:
Alternatively, and more complicated, you can use operation queues:
Where,
GeocodeOperation.h:And,
GeocodeOperation.m:And
AsynchronousOperation.h:And
AsynchronousOperation.m: