简体   繁体   English

Swift / Objective C - performTransitionOperation崩溃

[英]Swift / Objective C - performTransitionOperation Crash

I've been going at this for a while now and I'd love to hear some potential solutions. 我已经有一段时间了,我想听听一些可能的解决方案。 Essentially, I'm trying to incorporate a right menu/nav using SWRevealViewController , but when I attempt to go log into the app and go to my home screen/logged in landing, the app crashes. 基本上,我正在尝试使用SWRevealViewController合并一个正确的菜单/导航,但当我尝试登录应用程序并转到我的主屏幕/登录登陆时,应用程序崩溃。 The app doesn't crash when the segue is a modal,etc. 当segue是模态等时,应用程序不会崩溃。 but it continues to crash while it's set to the appropriate segue for the plugin I'm currently using. 但它继续崩溃,而它设置为我目前使用的插件的相应segue。

Here is the console output when the app crashes: 这是应用程序崩溃时的控制台输出:

2016-11-12 22:21:04.861 Freely Market[16811:3049283] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Freely_Market.LoginViewController _performTransitionOperation:withViewController:animated:]: unrecognized selector sent to instance 0x7fc71950ea30' 2016-11-12 22:21:04.861自由市场[16811:3049283] ***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [Freely_Market.LoginViewController _performTransitionOperation:withViewController:animated:]:无法识别的选择器发送到实例0x7fc71950ea30'

For those who will wonder what the UI of the application looks like - here: 对于那些想知道应用程序的UI是什么样子的人 - 这里:

用户界面图像

1 is the login button, that is where the user is then passed onto the following screen pending that their information matche what is stored within the system. 1是登录按钮,然后用户被传递到下一个屏幕,等待他们的信息匹配系统中存储的内容。

2 is the segue, sw_front 2是segue,sw_front

3 is the logged in screen 3是登录屏幕

4 is the segue sw_right 4是segue sw_right

5 is the menu 5是菜单

The segues are set up properly, and I think I'm onto the right track when it comes to finding out exactly what the issue is here.. segues设置得恰到好处,我想在找到问题所在的时候我正走在正确的轨道上。

Here is where the error is at, or where it is decoding from: \\ 这是错误所在的位置,或者解码的位置:\\

- (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];
}

So from what I can tell, the application thinks that it is using this selector: _performtransitionOperation:withViewController:animated:] 从我所知,应用程序认为它正在使用这个选择器: _performtransitionOperation:withViewController:animated:]

But that is obviously not Swift, and is Objective-C. 但这显然不是Swift,而是Objective-C。 So I'm not quite sure how to get my segue to actually operate as it should. 所以我不太确定如何让我的segue实际操作应该如此。

This is where the segue is being called from after verifying the user's login information. 这是在验证用户的登录信息之后调用segue的地方。

} else if (username.isEqual(to: usernameV!) && password.isEqual(to: passwordV!)) {

       self.performSegue(withIdentifier: "sw_front", sender: self)

And this is where I am stuck, maybe it is just an issue with Objective-C and Swift clashing? 这就是我被困的地方,也许这只是Objective-C和Swift冲突的问题? Other's have gotten this add-in to work just fine without any issues, but I have not. 其他人已经让这个加载项工作得很好而没有任何问题,但我没有。 Maybe it is because I am verifying user login information and then passing it onto this new screen, where as others just start at the basic screen. 也许是因为我正在验证用户登录信息,然后将其传递到这个新屏幕,而其他人只是从基本屏幕开始。

Any help is appreciated. 任何帮助表示赞赏。

Issue was solved. 问题解决了。

I needed to create a separate view controller in between the login confirmation and the instances where SWRevealViewController would be called. 我需要在登录确认和将调用SWRevealViewController的实例之间创建一个单独的视图控制器。

If you would like to read into the issue further on the Git repository for SWRevealViewController, you can do so here: SWRevealViewController Issue #642 如果您想在SWRevealViewController的Git存储库中进一步阅读该问题,可以在此处执行此操作: SWRevealViewController问题#642

An image view of what I am speaking about can be found here: 我可以在这里找到我所说的图像视图:

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM