XShareController *share = [self.storyboard instantiateViewControllerWithIdentifier:@"XShare"];
    [share setData:[NSMutableDictionary dictionaryWithDictionary:self.data]];
    DLog(@"shareTouch");
    if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) {
        UIViewController *controller = [[self.view window] rootViewController];
        if (controller) {
            [controller setModalPresentationStyle:UIModalPresentationCurrentContext];
            [self presentViewController:share animated:YES completion:^{
                [controller setModalPresentationStyle:UIModalPresentationFullScreen];
            }];
        }
    }else{
            [share setModalPresentationStyle:UIModalPresentationOverCurrentContext];
            [self presentViewController:share animated:YES completion:nil];    }我这样写有问题吗,XShareController是我在sb中创建的一个vc,这样写在8.0以上跳转运行到最后一句[self presentViewController:share animated:YES completion:nil];就崩,哪位大神知道原因帮我解答下

解决方案 »

  1.   

    我这边用你的代码,不会崩溃,是不是你的setData:方法有问题啊?
      

  2.   

    setData只是一个赋值而已,应该不会有问题吧
      

  3.   

    setData在编译运行时也没有报错,反而是断在最后一步跳转
      

  4.   

    presentViewController不要使用VC,使用UINavigationController。一个例子:UIStoryboard *productStoryboard = [UIStoryboard storyboardWithName:@"Product" bundle:nil];
    UINavigationController *productNav = [productStoryboard instantiateViewControllerWithIdentifier:@"productNAV"];
    [self presentViewController:productNav animated:YES completion:^{}];
      

  5.   

    @crash163
    没有用,还是会在最后跳转代码时崩溃,其实之前也有一个文件用了相同的跳转是可以的,在这就会崩,我比对了几次也没发现有不同的地方
      

  6.   

    我个人觉得    推出奔溃   应该是你的share  这个VC 是有问题的吧?  
    问题解决了么   ,求分享啊  
      

  7.   

    else 之后的就是8.0以后跳转的代码
      

  8.   

    你看看对应关系,你还缺一个else
      

  9.   

    if(controller)是说控制器存在就跳转,不存在就不操作,没有else对应
    else里的代码会在8.0以上时调用,我测试过了,应该没有问题的,其实这段代码,在别的地方也调用过,么有问题,但是在这就会最后崩,我检查好多遍也没检查出来不同