As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Hi, recently I have started using the KCSQuery in Swift to get data from the database. However, since all the methods are asynchronous, I can only get the data I want in the completion blocks.
Is there any way to make the query synchronous so the programwaits for the data to be retrieved before moving on to the next line of code?
Can you explain in detail why you would want these calls to be synchronous?
Thanks,
C
Charles
said
about 8 years ago
Sometimes I need to verify the data retrieved from the database before continuing to the next function and the only way I can do it now is to put everything including other KCSQuery into the completion block. I am just wondering if that's the right way to do it because nested completion blocks look very messy.
P
Pranav J
said
about 8 years ago
Charles,
Kinvey queries work in asynchronous way. We should avoid using synchronous as it blocks main thread until the request is completed. You have done it in the correct way by using nested completion blocks.
Charles
Hi, recently I have started using the KCSQuery in Swift to get data from the database. However, since all the methods are asynchronous, I can only get the data I want in the completion blocks.
Is there any way to make the query synchronous so the programwaits for the data to be retrieved before moving on to the next line of code?