facebook graph api - My Singleton Class isn't executing a block method, objective-c -


the method i'm calling

-(void)initialloginuser{          __block bool jobdone = no;         __weak typeof(self) weakself = self;          [self setself:^{   // block method gets called never enters block           nslog(@"entered here"); //never arrives here         [weakself uploaduserdata]; //here         jobdone = yes;  //or here      }];      nsdate *loopuntil = [nsdate datewithtimeintervalsincenow:10];     while (jobdone == no && [loopuntil timeintervalsincenow] > 0) {         [[nsrunloop currentrunloop] runmode:nsdefaultrunloopmode                                  beforedate:loopuntil];     }  } 

the block i'm calling

- (void)setself:(void(^)(void))callback{     if ([fbsdkaccesstoken currentaccesstoken]) {         [[[fbsdkgraphrequest alloc] initwithgraphpath:@"/me" parameters:nil]          startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, nsdictionary* result, nserror *error) {              if (!error) {                  dispatch_async(dispatch_get_main_queue(), ^{                      myuser.userid = credentialsprovider.identityid;                      myuser.firstname = [result objectforkey:@"first_name"];                      myuser.lastname = [result objectforkey:@"last_name"];                      myuser.facebookid = [result objectforkey:@"id"];                  });               }          }];     } } 

unfortunately i'm relatively new topic of threading , blocks might seem little uneducated in field. have used blocks before , know should executing code within block. setself working when until has execute block. can tell because myuser object set perfectly.

this may irrelevant want avoid lack of explanation wanted mention these methods called singleton class. please let me know if have idea why inside of block of setself never gets called.

thank you


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -