我试图将UITableViewController添加到Today Widget,但每次我将UITableViewController拖到Storyboard并运行Widget时都会崩溃并出现以下错误。
我已多次尝试过。我已经通过使用Table View对象尝试了它,但问题仍然存在。
注意:即使在加载viewDidLoad()方法之前它也会崩溃。
2015-06-06 01:19:20.569 iOSHackerToday [3202:283287] *由于未捕获的异常而终止应用 ' NSInvalidArgumentException',原因:' * - [ NSArrayM insertObject:atIndex:]:object不能为nil' ***第一次抛出调用堆栈:(0 CoreFoundation 0x0000000107842c65 __exceptionPreprocess + 165 1 libobjc.A.dylib
0x00000001074dbbb7 objc_exception_throw + 45 2 CoreFoundation
0x000000010770f8ca - [__ NSArrayM insertObject:atIndex:] + 954 3
UIKit 0x0000000107d6f0b9 - [UIViewController _addChildViewController:performHierarchyCheck:notifyWillMove:] + 338 4 UIKit 0x0000000108241a0c - [_ UIViewServiceViewControllerOperator __createViewController:withContextToken:fbsDisplays:appearanceSerializedRepresentations:legacyAppearance:traitCollection:initialInterfaceOrientation:hostAccessibilityServerPort:canShowTextServices:replyHandler:] + 2216 5 CoreFoundation 0x0000000107738dec __invoking _ + 140 6 CoreFoundation 0x0000000107738c42 - [NSInvocation invoke] + 290 7 CoreFoundation
0x00000001077c9016 - [NSInvocation invokeWithTarget:] + 54 8 UIKit
0x00000001082fd01b - [_ UIViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 222 9 CoreFoundation
0x000000010779ff4f 转发 + 495 10 CoreFoundation
0x000000010779fcd8 _CF_forwarding_prep_0 + 120 11 CoreFoundation
0x0000000107738dec 调用_ + 140 12 CoreFoundation
0x0000000107738c42 - [NSInvocation invoke] + 290 13 CoreFoundation
0x00000001077c9016 - [NSInvocation invokeWithTarget:] + 54 14 UIKit
0x00000001082889f4 - [_ UIQueueingProxy forwardInvocation:] + 319 15 CoreFoundation 0x000000010779ff4f 转发 + 495 16 CoreFoundation 0x000000010779fcd8 _CF_forwarding_prep_0 + 120 17 CoreFoundation
0x0000000107738dec 调用_ + 140 18 CoreFoundation
0x0000000107738c42 - [NSInvocation invoke] + 290 19 CoreFoundation
0x00000001077c9016 - [NSInvocation invokeWithTarget:] + 54 20 CoreFoundation 0x000000010779ff4f 转发 + 495 21 CoreFoundation 0x000000010779fcd8 _CF_forwarding_prep_0 + 120 22 CoreFoundation
0x0000000107738dec 调用_ + 140 23 CoreFoundation
0x0000000107738c42 - [NSInvocation invoke] + 290 24 libdispatch.dylib 0x0000000109da6f16 _dispatch_call_block_and_release + 12 25 libdispatch.dylib 0x0000000109dc1964 _dispatch_client_callout + 8 26 libdispatch.dylib 0x0000000109daca59 _dispatch_main_queue_callback_4CF + 704 27 CoreFoundation 0x00000001077aa1f9 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 28 CoreFoundation 0x000000010776bdcb __CFRunLoopRun + 2043 29 CoreFoundation 0x000000010776b366 CFRunLoopRunSpecific + 470 30图形服务
0x000000010b01ca3e GSEventRunModal + 161 31 UIKit
0x0000000107c3b900 UIApplicationMain + 1282 32 libxpc.dylib
0x000000010a0a7aec _xpc_objc_main + 453 33 libxpc.dylib
0x000000010a0a9e91 xpc_main + 185 34基金会 0x0000000107209ee1 service_connection_handler + 0 35 PlugInKit
0x0000000106ff3a82 - [PKService run] + 521 36 PlugInKit
0x0000000106ff3747 + [PKService main] + 55 37 PlugInKit
0x0000000106ff3aa6 + [PKService _defaultRun:arguments:] + 17 38 libextension.dylib 0x000000010978399d NSExtensionMain + 51 39 libdyld.dylib 0x0000000109df1145 start + 1 40 ??? 0x0000000000000001 0x0 + 1)libc ++ abi.dylib:以未捕获的类型异常终止 NSException(lldb)
答案 0 :(得分:1)
删除默认布局并拖动新的表格视图控制器时,需要将新视图控制器标记为“初始视图控制器”
这是Apple的文档,它解释了如何做到这一点。 https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/chapters/SetInitialController.html
答案 1 :(得分:0)