从 TWTRShareEmailViewController 切换到另一个控制器 - Twitter fabric ios sdk
Posted
技术标签:
【中文标题】从 TWTRShareEmailViewController 切换到另一个控制器 - Twitter fabric ios sdk【英文标题】:Switch from TWTRShareEmailViewController to another controller - Twitter fabric ios sdk 【发布时间】:2016-01-20 07:31:15 【问题描述】:我正在使用下面的代码从 TWTRShareEmailViewController 跳转到另一个控制器,但它没有导航。我有一个嵌入了导航控制器的标签栏控制器,尝试推动视图控制器仍然无法正常工作。
-(IBAction)loginWithTwitter:(id)sender
[JTProgressHUD show];
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error)
if (session)
[self fetchUserEmail];
[JTProgressHUD hide];
else
NSLog(@"error: %@", [error localizedDescription]);
];
-(void)fetchUserEmail
if ([[Twitter sharedInstance] session])
TWTRShareEmailViewController* shareEmailViewController = [[TWTRShareEmailViewController alloc] initWithCompletion:^(NSString* email, NSError* error) )
TabBar *bar = [self.storyboard instantiateViewControllerWithIdentifier:@"tabBar"];
[self presentViewController:bar animated:YES completion:nil];
else
NSLog(@"error :%@",error);
];
[self presentViewController:shareEmailViewController animated:YES completion:nil];
else
但它不会转移到下一个控制器。请帮忙。
【问题讨论】:
【参考方案1】:我自己修好了。在这里发帖,对其他人有帮助。
-(void)fetchUserEmail
if ([[Twitter sharedInstance] session])
TWTRShareEmailViewController* shareEmailViewController = [[TWTRShareEmailViewController alloc] initWithCompletion:^(NSString* email, NSError* error)
NSLog(@"email %@",email);
TabBar *bar = [self.storyboard instantiateViewControllerWithIdentifier:@"tabBar"];
dispatch_async(dispatch_get_main_queue(), ^
NSLog(@"Inside the loop");
[self presentViewController:bar animated:YES completion:nil];
);
];
[self presentViewController:shareEmailViewController animated:YES completion:nil];
else
【讨论】:
以上是关于从 TWTRShareEmailViewController 切换到另一个控制器 - Twitter fabric ios sdk的主要内容,如果未能解决你的问题,请参考以下文章