繁体   English   中英

PKReveal Controller UIVIEW无法识别的选择器已发送到实例

[英]PKReveal Controller UIVIEW unrecognized selector sent to instance

好的,我已经非常努力地浏览了有关PKRevealController的所有其他帖子,并弄清楚了这一点……但是到目前为止,这还没有发生。 所以这就是我所拥有的:

AppDelegate.m

    ViewController *viewController = (ViewController *)self.window.rootViewController;

    UIViewController *leftViewController = [[UIViewController alloc] init];

    leftViewController.view.backgroundColor = [UIColor redColor];

    PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:viewController rightViewController:leftViewController];

    self.window.rootViewController = revealController;

我的主视图仅称为ViewController。 我只是想让左滑动工作。 也许我只是对应该做的事情感到困惑...但这给了我这个错误:

2015-02-06 14:02:40.810 bibi[5421:90b] (null)
2015-02-06 14:02:41.823 bibi[5421:90b] -[UIViewController setRevealController:]: unrecognized selector sent to instance 0xcd7c9f0
2015-02-06 14:02:41.870 bibi[5421:90b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setRevealController:]: unrecognized selector sent to instance 0xcd7c9f0'


    *** First throw call stack:
(
    0   CoreFoundation                      0x02e181e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x02b978e5 objc_exception_throw + 44
    2   CoreFoundation                      0x02eb5243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x02e0850b ___forwarding___ + 1019
    4   CoreFoundation                      0x02e080ee _CF_forwarding_prep_0 + 14
    5   bibi                                0x00007f55 -[PKRevealController initWithFrontViewController:leftViewController:rightViewController:options:] + 357
    6   bibi                                0x00007d59 -[PKRevealController initWithFrontViewController:rightViewController:options:] + 185
    7   bibi                                0x00007afc +[PKRevealController revealControllerWithFrontViewController:rightViewController:] + 188
    8   bibi                                0x0001fa61 -[AppDelegate redirect] + 321
    9   Foundation                          0x025c05ec __NSFireDelayedPerform + 372
    10  CoreFoundation                      0x02dd6ac6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    11  CoreFoundation                      0x02dd64ad __CFRunLoopDoTimer + 1181
    12  CoreFoundation                      0x02dbe538 __CFRunLoopRun + 1816
    13  CoreFoundation                      0x02dbd9d3 CFRunLoopRunSpecific + 467
    14  CoreFoundation                      0x02dbd7eb CFRunLoopRunInMode + 123
    15  GraphicsServices                    0x04de85ee GSEventRunModal + 192
    16  GraphicsServices                    0x04de842b GSEventRun + 104
    17  UIKit                               0x0164af9b UIApplicationMain + 1225
    18  bibi                                0x000eea3d main + 141
    19  libdyld.dylib                       0x0335f725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我敢肯定,我只是想念这简单而愚蠢的东西。 但是它很冷,我感冒了,在尝试并阅读了两天的所有SO帖子后我还是没有得到...

编辑:如果有帮助,添加了完整的日志。

好。 事实证明,我的代码绝对没有错,而我的问题的解决方案是我以前从未见过的解决方案,因此我将其发布在这里:

我使用Cocoapods安装了PKRevealController,但安装并未真正成功完成,并给了我以下错误:

Debug is overwriting the Build Settings for "HEADER_LINK_PATH"
Debug is overwriting the Build Settings for "OTHER_LD_FLAGS"

我在构建设置中加载了libsql和ObjC以及其他一些内容,但是我没有继承PKRevealController的Pod设置。

删除ObjC并在这些路径中使用“ $ inherited”有助于加载PKRevealController,此后程序运行正常。 就像遇到此问题的任何人的注释一样,您可以在一行上加载所需的设置(在我的情况下为libsql ...),在另一行上加载$继承,它们将一起正常工作。 只要记住要清理您的构建并擦除模拟器(甚至可以重启Xcode),然后重新构建即可。

暂无
暂无

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

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