如何在 FBSessionDelegate 方法中执行 segue?
我有一个关于 facebook iPhone SDK 的问题,我希望有人能帮助我!首先:我正在使用故事板。在我的 AppDelegate 文件中,我像这样初始化 Facebook:
Start *startController = [[Start alloc] init];
facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:startController];
因此,我可以在 StartController 中处理委托选择器。到目前为止,一切正常,Facebook 用户可以登录,我可以获得有关他的信息。我的问题从这里开始:
#pragma mark - FBSessionDelegate Methods
- (void)fbDidLogin {
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[self storeAuthData:[[delegate facebook] accessToken] expiresAt:[[delegate facebook] expirationDate]];
[self performSegueWithIdentifier:@"facebookLoginSegue" sender:nil];
}
当用户成功登录时,将调用此选择器。在我的故事板中有一个名为“facebookLoginSegue”的segue,它从视图控制器开始。视图控制器具有“Start”类。
// 编辑:当然,我已将 Segue 连接到另一个视图控制器。
比我得到一个错误:
*** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Receiver (<Start: 0x94b48d0>) has no segue with identifier 'facebookLoginSegue'
我不明白为什么无法找到转场。我已经用 IBAction 测试了该 segue 是否存在 - 但如果我这样做,它就会起作用。
有人可以告诉我我做错了什么吗?我可以做什么来在该委托选择器中执行 segue? 谢谢你的帮助。
I've got a question about the facebook iPhone SDK, i hope somebody can help me! First of all: i'm using storyboards. In my AppDelegate file I initialize Facebook like this:
Start *startController = [[Start alloc] init];
facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:startController];
As a result of that I can handle the delegate selectors in my StartController. Up to here everything works fine, a facebook user can login and I get information about him. My problem starts here:
#pragma mark - FBSessionDelegate Methods
- (void)fbDidLogin {
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[self storeAuthData:[[delegate facebook] accessToken] expiresAt:[[delegate facebook] expirationDate]];
[self performSegueWithIdentifier:@"facebookLoginSegue" sender:nil];
}
This selector is called when the user successfully logged in. There is a segue called 'facebookLoginSegue' in my storyboard which starts from the viewcontroller. The viewcontroller has got the class 'Start'.
// edit: I've connected the segue to another view controller, of course.
Than I get an error:
*** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> Receiver (<Start: 0x94b48d0>) has no segue with identifier 'facebookLoginSegue'
I don't understand why the segue cannot be found. I've already tested with an IBAction if that segue exists - but if I do it like that, it works.
Can someone tell me what I'm doing wrong? What can I do to perform a segue in that delegate selector?
Thank you for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的故事板文件没有segue @“facebookLoginSegue”
您可能将@“facebookLoginSegue”链接到其他视图控制器,但不启动ViewController
your storyboard file don't have segue @"facebookLoginSegue"
you maybe link @"facebookLoginSegue" to other viewcontroller but not Start ViewController