i'm trying pass view controller programmatically when facebook datas, there way that? using method app crashes , in log have that:
2015-07-16 13:16:14.125 loginsamplefb[1059:60b] warning: attempt present on view not in window hierarchy! 2015-07-16 13:16:14.129 loginsamplefb[1059:60b] exception 'nsrangeexception' caught! reason: 'cannot remove observer key path "hidden" because not registered observer.' 2015-07-16 13:16:14.171 loginsamplefb[1059:60b] * assertion failure in -[uiwindowcontroller transition:fromviewcontroller:toviewcontroller:target:didendselector:animation:], /sourcecache/uikit/uikit-2935.137/uiwindowcontroller.m:223 2015-07-16 13:16:14.172 loginsamplefb[1059:60b] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'attempting begin modal transition while transition in progress. wait viewdidappear/viewdiddisappear know current transition has completed' *** first throw call stack: (0x185e6ef50 0x1923781fc 0x185e6ee10 0x1869a6db4 0x188f2e5b8 0x188f2da9c 0x1000fabb8 0x1869e42d0 0x185e2f554 0x185e2f1c4 0x185e2ceec 0x185d6dc20 0x18ba55c0c 0x188e9efdc 0x1000fded8 0x19296baa0) libc++abi.dylib: terminating uncaught exception of type nsexception
this code :
- (void)loginviewfetcheduserinfo:(fbloginview *)loginview user:(id<fbgraphuser>)user { nsstring *username = user.name; username = [username stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"]; nsstring *usernameok = username; nsstring *userid = [user id]; nsstring *useremail = [user objectforkey:@"email"]; nsstring *label_name = user.name; _profilepicture.profileid = ((dashboardviewcontroller*)self.tabbarcontroller).id; _profilepicture.layer.cornerradius = _profilepicture.frame.size.width / 2; _profilepicture.clipstobounds = yes; _profilepicture.layer.borderwidth = 3.0f; _profilepicture.layer.bordercolor = [uicolor whitecolor].cgcolor; //self.lblemail.text = [user objectforkey:@"email"]; ((dashboardviewcontroller*)self.tabbarcontroller).first_name = usernameok; ((dashboardviewcontroller*)self.tabbarcontroller).id = userid; dashboardviewcontroller *dashboardviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"dashboardviewcontroller"]; dashboardviewcontroller.first_name = usernameok; dashboardviewcontroller.label_name= username; dashboardviewcontroller.id = userid; dashboardviewcontroller.useremail = useremail; [self presentmodalviewcontroller:dashboardviewcontroller animated:yes]; } edit
this full code
#import "viewcontroller.h" #import "dashboardviewcontroller.h" #import "bfpapertabbarcontroller.h" #import <facebooksdk/facebooksdk.h> @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. self.loginbutton.delegate = self; self.loginbutton.readpermissions = @[@"public_profile", @"email", @"publish_actions"]; self.view.backgroundcolor=[uicolor colorwithpatternimage:[uiimage imagenamed:@"background.png"]]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } /*-(void)viewdidappear:(bool)animated { dashboardviewcontroller *dashboardviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"dashboardviewcontroller"]; nsstring *usr = ((dashboardviewcontroller*)self.tabbarcontroller).first_name; nslog(usr); if (usr != @"0") { nslog(usr); nslog(@"usr diverso da 0"); [self presentmodalviewcontroller:dashboardviewcontroller animated:yes]; } }*/ - (void)loginviewfetcheduserinfo:(fbloginview *)loginview user:(id<fbgraphuser>)user { nsstring *username = user.name; username = [username stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"]; nsstring *usernameok = username; nsstring *userid = [user id]; nsstring *useremail = [user objectforkey:@"email"]; nsstring *label_name = user.name; _profilepicture.profileid = ((dashboardviewcontroller*)self.tabbarcontroller).id; _profilepicture.layer.cornerradius = _profilepicture.frame.size.width / 2; _profilepicture.clipstobounds = yes; _profilepicture.layer.borderwidth = 3.0f; _profilepicture.layer.bordercolor = [uicolor whitecolor].cgcolor; //self.lblemail.text = [user objectforkey:@"email"]; ((dashboardviewcontroller*)self.tabbarcontroller).first_name = usernameok; ((dashboardviewcontroller*)self.tabbarcontroller).id = userid; dashboardviewcontroller *dashboardviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"dashboardviewcontroller"]; dashboardviewcontroller.first_name = usernameok; dashboardviewcontroller.label_name= username; dashboardviewcontroller.id = userid; dashboardviewcontroller.useremail = useremail; [self presentmodalviewcontroller:dashboardviewcontroller animated:yes]; } -(void)loginview:(fbloginview *)loginview handleerror:(nserror *)error{ nslog(@"%@", [error localizeddescription]); } -(ibaction)skip:(id)sender{ nsstring *username = @"0"; nsstring *usernameok = username; nsstring *userid = @"0"; nsstring *useremail = @"0"; nsstring *label_name = @"loggati"; _profilepicture.profileid = ((dashboardviewcontroller*)self.tabbarcontroller).id; _profilepicture.layer.cornerradius = _profilepicture.frame.size.width / 2; _profilepicture.clipstobounds = yes; _profilepicture.layer.borderwidth = 3.0f; _profilepicture.layer.bordercolor = [uicolor whitecolor].cgcolor; //self.lblemail.text = [user objectforkey:@"email"]; ((dashboardviewcontroller*)self.tabbarcontroller).first_name = usernameok; ((dashboardviewcontroller*)self.tabbarcontroller).id = userid; dashboardviewcontroller *dashboardviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"dashboardviewcontroller"]; dashboardviewcontroller.first_name = usernameok; dashboardviewcontroller.label_name= username; dashboardviewcontroller.id = userid; dashboardviewcontroller.useremail = useremail; [self presentmodalviewcontroller:dashboardviewcontroller animated:yes]; } @end
Comments
Post a Comment