尝试做PageViewController时出现X code7错误

时间:2017-01-04 12:12:57

标签: swift xcode

在我的主要故事板中,我有我的firstViewController然后是secondViewController,而我的pageViewController是第三个。 我使用seque Modal连接所有这些。 第一和第二是工作,但我的第三个正在向我显示错误。

    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fb15bca4dd0>) doesn't contain a view controller with identifier 'FirstViewController''
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108ba7f65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010aa62deb objc_exception_throw + 48
    2   UIKit                               0x0000000109ccc5d4 -[UIStoryboard instantiateInitialViewController] + 0
    3                             0x00000001089b422d _TFC8test23SkillPageViewControllerP33_B1A346F97B9DE8BA73F8676576C06E1324newColoredViewControllerfS0_FSSCSo16UIViewController + 365
    4                              0x00000001089b65cc _TFFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_U_FT_GSaS1__ + 92
    5                              0x00000001089b2f75 _TFC8test23SkillPageViewControllerg22orderedViewControllersGSaCSo16UIViewController_ + 325
    6                              0x00000001089b3229 _TFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 313
    7                               0x00000001089b35e2 _TToFC8test23SkillPageViewController11viewDidLoadfS0_FT_T_ + 34
    8   UIKit                               0x0000000109775931 -[UIViewController loadViewIfRequired] + 1344
    9   UIKit                               0x0000000109775c7d -[UIViewController view] + 27
    10  UIKit                               0x0000000109edbb2c -[_UIFullscreenPresentationController _setPresentedViewController:] + 87
    11  UIKit                               0x000000010974603a -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 133
    12  UIKit                               0x00000001097885c4 -[UIViewController _presentViewController:withAnimationController:completion:] + 3930
    13  UIKit                               0x000000010978b878 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 489
    14  UIKit                               0x000000010978b387 -[UIViewController presentViewController:animated:completion:] + 179
    15  UIKit                               0x0000000109ce2af3 __67-[UIStoryboardModalSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 243
    16  UIKit                               0x0000000109cd1189 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 460
    17  UIKit                               0x0000000109cd0f8c -[UIStoryboardSegueTemplate _perform:] + 82
    18  UIKit                               0x0000000109cd1250 -[UIStoryboardSegueTemplate perform:] + 156
    19  UIKit                               0x00000001095ec1fa -[UIApplication sendAction:to:from:forEvent:] + 92
    20  UIKit                               0x0000000109750504 -[UIControl sendAction:to:forEvent:] + 67
    21  UIKit                               0x00000001097507d0 -[UIControl _sendActionsForEvents:withEvent:] + 311
    22  UIKit                               0x000000010974f906 -[UIControl touchesEnded:withEvent:] + 601
    23  UIKit                               0x0000000109656aa3 -[UIWindow _sendTouchesForEvent:] + 835
    24  UIKit                               0x0000000109657691 -[UIWindow sendEvent:] + 865
    25  UIKit                               0x0000000109609752 -[UIApplication sendEvent:] + 263
    26  UIKit                               0x00000001095e4fcc _UIApplicationHandleEventQueue + 6693
    27  CoreFoundation                      0x0000000108ad40a1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    28  CoreFoundation                      0x0000000108ac9fcc __CFRunLoopDoSources0 + 556
    29  CoreFoundation                      0x0000000108ac9483 __CFRunLoopRun + 867
    30  CoreFoundation                      0x0000000108ac8e98 CFRunLoopRunSpecific + 488
    31  GraphicsServices                    0x000000010e099ad2 GSEventRunModal + 161
    32  UIKit                               0x00000001095ea676 UIApplicationMain + 171
    33                                 0x00000001089ba10d main + 109
    34  libdyld.dylib                       0x000000010b58192d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

1 个答案:

答案 0 :(得分:0)

这是一个很难猜测,因为你没有提供任何代码,但作为错误状态, 您需要在Storyboard&gt;中为您使用的视图控制器设置标识符。 ViewController(你添加到storyboard中的一个,我认为它是FirstViewController)&gt;属性检查器 有一个叫做故事板标识符或类似的东西,你需要设置它。因为我看到你需要将它命名为“FirstViewController”

我认为您正在跳过配置pageviewcontroller的一些主要步骤,有一个非常好的教程here 如果你查看本教程,那将非常有用