[英]Swift / Objective C - performTransitionOperation Crash
我已经有一段时间了,我想听听一些可能的解决方案。 基本上,我正在尝试使用SWRevealViewController合并一个正确的菜单/导航,但当我尝试登录应用程序并转到我的主屏幕/登录登陆时,应用程序崩溃。 当segue是模态等时,应用程序不会崩溃。 但它继续崩溃,而它设置为我目前使用的插件的相应segue。
这是应用程序崩溃时的控制台输出:
2016-11-12 22:21:04.861自由市场[16811:3049283] ***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [Freely_Market.LoginViewController _performTransitionOperation:withViewController:animated:]:无法识别的选择器发送到实例0x7fc71950ea30'
对于那些想知道应用程序的UI是什么样子的人 - 这里:
1是登录按钮,然后用户被传递到下一个屏幕,等待他们的信息匹配系统中存储的内容。
2是segue,sw_front
3是登录屏幕
4是segue sw_right
5是菜单
segues设置得恰到好处,我想在找到问题所在的时候我正走在正确的轨道上。
这是错误所在的位置,或者解码的位置:\\
- (void)perform
{
SWRevealControllerOperation operation = SWRevealControllerOperationNone;
NSString *identifier = self.identifier;
SWRevealViewController *rvc = self.sourceViewController;
UIViewController *dvc = self.destinationViewController;
if ( [identifier isEqualToString:SWSegueFrontIdentifier] )
operation = SWRevealControllerOperationReplaceFrontController;
else if ( [identifier isEqualToString:SWSegueRearIdentifier] )
operation = SWRevealControllerOperationReplaceRearController;
else if ( [identifier isEqualToString:SWSegueRightIdentifier] )
operation = SWRevealControllerOperationReplaceRightController;
if ( operation != SWRevealControllerOperationNone )
[rvc _performTransitionOperation:operation withViewController:dvc animated:YES];
}
从我所知,应用程序认为它正在使用这个选择器: _performtransitionOperation:withViewController:animated:]
但这显然不是Swift,而是Objective-C。 所以我不太确定如何让我的segue实际操作应该如此。
这是在验证用户的登录信息之后调用segue的地方。
} else if (username.isEqual(to: usernameV!) && password.isEqual(to: passwordV!)) {
self.performSegue(withIdentifier: "sw_front", sender: self)
这就是我被困的地方,也许这只是Objective-C和Swift冲突的问题? 其他人已经让这个加载项工作得很好而没有任何问题,但我没有。 也许是因为我正在验证用户登录信息,然后将其传递到这个新屏幕,而其他人只是从基本屏幕开始。
任何帮助表示赞赏。
问题解决了。
我需要在登录确认和将调用SWRevealViewController的实例之间创建一个单独的视图控制器。
如果您想在SWRevealViewController的Git存储库中进一步阅读该问题,可以在此处执行此操作: SWRevealViewController问题#642
我可以在这里找到我所说的图像视图:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.