topViewController:无法识别的选择器错误,其中包含custome segue到navigationController

时间:2015-03-06 16:47:00

标签: ios objective-c

我试图使用" Slideout Sidebar"从这个github解决方案。

这是我的故事板:

enter image description here

我在我的代理

中使用延迟加载方法进行我的Uicollectionview

代码我有这个:

   ParseOperation *weakParser = parser;

    parser.completionBlock = ^(void) {
        if (weakParser.appRecordList) {
            dispatch_async(dispatch_get_main_queue(), ^{

           myCollectionViewController *rootViewControllers = (myCollectionViewController*)[(UINavigationController*)self.window.rootViewController topViewController];
 [weakParser.appRecordList valueForKey:@"id"]);
                rootViewControllers.entries = weakParser.appRecordList;
                if(weakParser.appRecordList == nil)
                     NSLog(@"weakParser.appRecordList is nill");
                if(weakParser.appRecordList != nil)
                    NSLog(@"weakParser.appRecordList is Not nil  l");

               [rootViewControllers.collectionView reloadData];

            });
        }

如果我在修改后运行我的项目,则返回此错误:

    2015-03-06 19:57:23.763 News[4995:51611] -[SWRevealViewController topViewController]: unrecognized selector sent to instance 0x7fdd5bd3c280
    2015-03-06 19:57:28.785 News[4995:51611] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SWRevealViewController topViewController]: unrecognized selector sent to instance 0x7fdd5bd3c280'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x0000000106b0ff35 __exceptionPreprocess + 165
        1   libobjc.A.dylib                     0x00000001067a8bb7 objc_exception_throw + 45
        2   CoreFoundation                      0x0000000106b1704d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
        3   CoreFoundation                      0x0000000106a6f27c ___forwarding___ + 988
        4   CoreFoundation                      0x0000000106a6ee18 _CF_forwarding_prep_0 + 120
        5   News                          0x0000000103481b2a __51-

[LazyTableAppDelegate connectionDidFinishLoading:]_block_invoke_2213 + 106

如果我在Parsoperation中注释掉代码部分,那么视图和滑动条工作完美,但是collectionview新数据没有显示出来,所以我想修改后的topcontroller不是" topViewController" 了。

我已尝试在block block中使用此代码,但没有任何事情发生:

            UIStoryboardSegue * segue;
            UINavigationController *navController = (UINavigationController*)[segue destinationViewController];
            myCollectionViewController *rootViewControllers = (myCollectionViewController*)[navController topViewController];

也尝试了这个(在collectionview类中有数据,但没有调用numberofitemsinsection):

   ParseOperation *weakParser = parser;
    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                             bundle: nil];
    myCollectionViewController *svc =[mainStoryboard instantiateViewControllerWithIdentifier:@"MainCategory"];
    parser.completionBlock = ^(void) {
        if (weakParser.appRecordList) {
            dispatch_async(dispatch_get_main_queue(), ^{
                svc.entries = weakParser.appRecordList;
                    [svc.collectionView reloadData];



            });
        }

0 个答案:

没有答案