UISplitViewController导致崩溃

时间:2014-03-07 09:46:03

标签: iphone crash uisplitviewcontroller

我使用过UISplitviewController。在第一次安装时,它会导致崩溃并跟随崩溃报告

Thread 0 Crashed:
0   libobjc.A.dylib                 0x386bab66 objc_msgSend + 6
1   UIKit                           0x30bac29c -[UISplitViewController _calculateDelegateHiddenMasterOrientations] + 56
2   UIKit                           0x30badec6 -[UISplitViewController setViewControllers:] + 1398
3   Max Sysutil Manager             0x000d4372 -[MainViewViewController backing:] (MainViewViewController.m:211)
4   Foundation                      0x2e9facd8 __NSFireTimer + 60
5   CoreFoundation                  0x2dfe0e7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12
6   CoreFoundation                  0x2dfe0a96 __CFRunLoopDoTimer + 790
7   CoreFoundation                  0x2dfdee1e __CFRunLoopRun + 1214
8   CoreFoundation                  0x2df4946c CFRunLoopRunSpecific + 520
9   CoreFoundation                  0x2df4924e CFRunLoopRunInMode + 102
10  GraphicsServices                0x32c502e6 GSEventRunModal + 134
11  UIKit                           0x307fe840 UIApplicationMain + 1132
12  Max Sysutil Manager             0x000a209e main (main.m:16)
13  libdyld.dylib                   0x38bb8ab4 start + 0

Thread 1:
0   libsystem_kernel.dylib          0x38c5c838 kevent64 + 24
1   libdispatch.dylib               0x38bab0d0 _dispatch_mgr_invoke + 228
2   libdispatch.dylib               0x38ba561e _dispatch_mgr_thread + 34

Thread 2:
0   libsystem_kernel.dylib          0x38c6fc7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x38cd3e06 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x38cd3cc0 start_wqthread + 4

Thread 3:
0   libsystem_kernel.dylib          0x38c6fc7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x38cd3e06 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x38cd3cc0 start_wqthread + 4

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x38c5cb9c swtch_pri + 8
1   libsystem_pthread.dylib         0x38cd604a sched_yield + 6
2   JavaScriptCore                  0x2ef6f242 JSC::DeadBlock* JSC::BlockAllocator::allocate<JSC::MarkedBlock>() + 46
3   JavaScriptCore                  0x2ef6f158 JSC::MarkedAllocator::allocateBlock(unsigned long) + 64
4   JavaScriptCore                  0x2ef6ef54 JSC::MarkedAllocator::allocateSlowCase(unsigned long) + 292
5   JavaScriptCore                  0x2efd810c JSC::JSActivation::create(JSC::VM&, JSC::ExecState*, JSC::CodeBlock*) + 240
6   JavaScriptCore                  0x2efae002 llint_slow_path_create_activation + 54
7   JavaScriptCore                  0x2efb57f6 llint_op_create_activation + 24
8   JavaScriptCore                  0x2efc255a JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 66
9   WebCore                         0x360e53d2 WebCore::JSMainThreadExecState::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 142
10  WebCore                         0x360e4fde WebCore::ScheduledAction::executeFunctionInContext(JSC::JSGlobalObject*, JSC::JSValue, WebCore::ScriptExecutionContext*) + 310
11  WebCore                         0x360e4bd4 WebCore::ScheduledAction::execute(WebCore::Document*) + 108
12  WebCore                         0x360e41f8 WebCore::DOMTimer::fired() + 436
13  WebCore                         0x360e3ccc WebCore::ThreadTimers::sharedTimerFiredInternal() + 132
14  WebCore                         0x360e3c1e WebCore::timerFired(__CFRunLoopTimer*, void*) + 22
15  CoreFoundation                  0x2dfe0e7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12
16  CoreFoundation                  0x2dfe0a96 __CFRunLoopDoTimer + 790
17  CoreFoundation                  0x2dfdee1e __CFRunLoopRun + 1214
18  CoreFoundation                  0x2df4946c CFRunLoopRunSpecific + 520
19  CoreFoundation                  0x2df4924e CFRunLoopRunInMode + 102
20  WebCore                         0x361720c0 RunWebThread(void*) + 416
21  libsystem_pthread.dylib         0x38cd5c5a _pthread_body + 138
22  libsystem_pthread.dylib         0x38cd5bca _pthread_start + 98
23  libsystem_pthread.dylib         0x38cd3ccc thread_start + 4

我完成了以下编码

in didFinishLaunchingWithOptions function 

MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
        UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];



        MainViewViewController *detailViewController1 = [[MainViewViewController alloc] initWithNibName:@"MainViewViewController" bundle:nil];
        UINavigationController *detailNavigationController1 = [[UINavigationController alloc] initWithRootViewController:detailViewController1];

        masterViewController.viewController = detailViewController1;

        self.splitViewController = [[UISplitViewController alloc] init];

        self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController1];
        self.splitViewController.delegate = detailViewController1;

        self.window.rootViewController = self.splitViewController;



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.view removeFromSuperview];

    [[NSUserDefaults standardUserDefaults] setInteger:indexPath.row forKey:@"HighScore"];
    // Navigation logic may go here, for example:
    // Create the next view controller.

    if(indexPath.row == 0)
    {
    MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
    UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];

    //        ViewController *detailViewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
    //        UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];

    MainViewViewController *detailViewController1 = [[MainViewViewController alloc] initWithNibName:@"MainViewViewController" bundle:nil];
    UINavigationController *detailNavigationController1 = [[UINavigationController alloc] initWithRootViewController:detailViewController1];




    self.splitViewController.viewControllers = @[masterNavigationController, detailNavigationController1];
    }

    if(indexPath.row == 1)
    {
        Battery1Controller *detailViewController = [[Battery1Controller alloc] initWithNibName:@"Battery1Controller" bundle:nil];



        UINavigationController *detailNavigationController1 = [[UINavigationController alloc] initWithRootViewController:detailViewController];

        MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil];
        UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];


        [masterViewController.tableView reloadData];
        self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController1, nil];
    }
}

应用程序通过ipa安装崩溃。崩溃的iOS 7.0.6。

0 个答案:

没有答案