dimanche 3 juillet 2016

Does Firebase signInWithEmail function run in main thread?


when I run the following code:


[[FIRAuth auth] signInWithEmail:@"myemail@mydomain.com"
                           password:@"hdfjhfjhdbf"
                         completion:^(FIRUser *user, NSError *error) {

                             NSLog(@"I am in Block");
                         }];
NSLog(@"I am here");

my output is : I am here I am in Block it means that the FIRAuth block runs in another thread other than main thread. I add an extra line to the code (while infinite loop)


[[FIRAuth auth] signInWithEmail:@"myemail@mydomain.com"
                           password:@"hdfjhfjhdbf"
                         completion:^(FIRUser *user, NSError *error) {

                             NSLog(@"I am in Block");
                         }];
NSLog(@"I am here");
while (YES) {};

my output is : I am here

the question: if the FIRAuth block runs in another thread it should print "I am in block" no matter we have infinite loop in main thread. how could it be possible?does the FIRAuth block runs by less priority in same main thread?


Aucun commentaire:

Enregistrer un commentaire