ios - Jump to View Controller after Login using Facebook SDK -


- (void)viewdidload {       delegate = (appdelegate*)[[uiapplication sharedapplication]delegate];      birthdaylist=[[birthdaylist alloc]initwithnibname:@"birthdaylist" bundle:nil];      spinner=[[uiactivityindicatorview alloc]initwithactivityindicatorstyle:uiactivityindicatorviewstylegray];     spinner.alpha=1.0;     spinner.center=cgpointmake(130, 150);     [spinner sethidden:yes];       uibutton *pickfriendsbutton=[[uibutton alloc]init];     [pickfriendsbutton setframe:(cgrectmake(100, 200, 150, 33))];     [pickfriendsbutton setbackgroundimage:[uiimage imagenamed:@"share_bg.png"] forstate:uicontrolstatenormal];     [pickfriendsbutton settitle:@"pick friends" forstate:uicontrolstatenormal];     [pickfriendsbutton settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal];     [pickfriendsbutton.titlelabel setfont:[uifont fontwithname:@"politica" size:15]];     [pickfriendsbutton addtarget:self action:@selector(pickfriends:) forcontrolevents:uicontroleventtouchupinside];     [self.view addsubview:pickfriendsbutton];       [super viewdidload];          fbloginview *loginview = [[fbloginview alloc] init];       loginview.frame = cgrectoffset(loginview.frame, 5, 5);     loginview.delegate = self;      [self.view addsubview:loginview];      [loginview sizetofit];       nsarray *permissions = [[nsarray alloc] initwithobjects:                             @"user_birthday",@"friends_hometown",                             @"friends_birthday",@"friends_location",@"basic_info",                             @"user_location",                             @"user_birthday",                             @"user_likes",                             nil];       loginview.readpermissions = permissions;      }  - (void)loginviewshowingloggedinuser:(fbloginview *)loginview  {     // first buttons set login mode          nslog(@"success");       if (fbsession.activesession.isopen)     {          nslog(@"token : %@",[[fbsession activesession]accesstokendata]);           fbrequest *friendrequest = [fbrequest requestforgraphpath:@"me/friends?fields=name,picture,birthday,location"];          [friendrequest startwithcompletionhandler:^(fbrequestconnection *connection, id result, nserror *error)         {             nsarray *data = [result objectforkey:@"data"];             (fbgraphobject<fbgraphuser> *friend in data)             {                 // nslog(@"%@",friend);                 [delegate.friendslistarray addobject:friend];                 nslog(@"%@:%@:%@", [friend name],[friend birthday],[friend id]);             }         }];     }      if ([delegate.friendslistarray count]!=0)      {          nsuserdefaults * standarddefaults=[nsuserdefaults standarduserdefaults];         [[nsuserdefaults standarduserdefaults] synchronize];          [standarddefaults setobject:delegate.friendslistarray forkey:@"friendslistarray"];         [standarddefaults setbool:yes forkey:@"logged_in"];         [standarddefaults synchronize];          nslog(@"%@",[standarddefaults objectforkey:@"friendslistarray"]);          [self.navigationcontroller pushviewcontroller:birthdaylist animated:yes];      }  } 

its cannot go view controller.i don't know.what problem?any have idea please me.thanks advance help.

first of all:

  1. check if delegate.friendslistarray have data in it. see log it. let's provide data here
  2. i remove code in if ([delegate.friendslistarray count]!=0) friendrequest startwithcompletionhandler block . after for() ofcourse
  3. if none of above not work you. try replace following code. start put other piece of code step step.

-(void)loginviewshowingloggedinuser:(fbloginview *)loginview {

   if (fbsession.activesession.isopen) {       birthdaylist *birthdaylist=[[birthdaylist alloc]initwithnibname:@"birthdaylist" bundle:nil];       [self.navigationcontroller pushviewcontroller:birthdaylist animated:yes];    } } 

more sample comment try this. hope figure rest of problem.

-(void)loginviewshowingloggedinuser:(fbloginview *)loginview {

   if (fbsession.activesession.isopen) {       fbrequest *friendrequest = [fbrequest requestforgraphpath:@"me/friends?fields=name,picture,birthday,location"];       [friendrequest startwithcompletionhandler:^(fbrequestconnection *connection, id result, nserror *error)       {           nsarray *data = [result objectforkey:@"data"];           (fbgraphobject<fbgraphuser> *friend in data)           {                [delegate.friendslistarray addobject:friend];           }           if ([delegate.friendslistarray count] > 0) {               birthdaylist *birthdaylist=[[birthdaylist alloc]initwithnibname:@"birthdaylist" bundle:nil];               [self.navigationcontroller pushviewcontroller:birthdaylist animated:yes];           } else {               uialertview *alertview = [[uialertview alloc] initwithtitle:@"error" message:@"friend not found" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil];               [alertview show];           }       }];     } } } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -