Ho un ciclo for che contiene tre metodi asincroni e voglio fare un po 'di trattamento dopo che sono finiti i 3 metodi asincroni.Attendi che i metodi asincroni finiscano in un ciclo for
-(void)getAllUsersInformations{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for(User *user in users){
[self getUserInfo:user];
}
//Here, I want to reload the table view for example, after finishing the for loop (executing the whole three methods).
});
}
-(void)getUserInfo:(User*)user{
[self getInformations:user];
[self getExperiences:user];
[self getEducation:user];
}
Avete qualche tecnica per avere questo risultato? Grazie mille.
sono 'getInformations',' 'getEducation', essi stessi, i metodi asincroni getExperiences' e? O sono tutti metodi sincroni che spediresti in modo asincrono a qualche coda in background? (La tua modifica alla domanda cambia radicalmente la risposta.) – Rob
@Rob; Sì, sono asincroni! 'getAllUsersInformations'' getInformations'' getExperiences' e' getEducation' sono asincroni. – androniennn
@androniennn puoi rendere sincroni i tre metodi '-getXXX'? –