iOS 11 EventKitUI 崩溃 -[EKCalendarChooser _selectAllCalendarsAndStores:]

iOS 11 Crash on EventKitUI -[EKCalendarChooser _selectAllCalendarsAndStores:]

此崩溃只发生在 iOS 11,我不知道如何修复它。

点击 iOS 11 的 EKCalendarChooser class 新工具栏上的 [Show All] 按钮时发生崩溃,但当它的 selectionStyle 设置为 .single 时:

致命异常:NSInternalInconsistencyException 无效样式

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x1830e3d38 __exceptionPreprocess
1  libobjc.A.dylib                0x1825f8528 objc_exception_throw
2  CoreFoundation                 0x1830e3c0c +[NSException raise:format:]
3  Foundation                     0x183a72c24 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4  EventKitUI                     0x1941ad908 -[EKCalendarChooser _selectAllCalendarsAndStores:]
5  EventKitUI                     0x1941a6384 -[EKCalendarChooser showAllButtonPressed]
6  UIKit                          0x18c52820c -[UIApplication sendAction:to:from:forEvent:]
7  UIKit                          0x18c68253c -[UIBarButtonItem(UIInternal) _sendAction:withEvent:]
8  UIKit                          0x18c52820c -[UIApplication sendAction:to:from:forEvent:]
9  UIKit                          0x18c52818c -[UIControl sendAction:to:forEvent:]
10 UIKit                          0x18c512f4c -[UIControl _sendActionsForEvents:withEvent:]
11 UIKit                          0x18c5130b4 -[UIControl _sendActionsForEvents:withEvent:]
12 UIKit                          0x18c527a80 -[UIControl touchesEnded:withEvent:]
13 UIKit                          0x18cb73ec8 _UIGestureEnvironmentSortAndSendDelayedTouches
14 UIKit                          0x18cb6f488 _UIGestureEnvironmentUpdate
15 CoreFoundation                 0x18308b8b8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
16 CoreFoundation                 0x183089270 __CFRunLoopDoObservers
17 CoreFoundation                 0x18308982c __CFRunLoopRun
18 CoreFoundation                 0x182faa2d8 CFRunLoopRunSpecific
19 GraphicsServices               0x184e3bf84 GSEventRunModal
20 UIKit                          0x18c557880 UIApplicationMain
21 MyApp1                         0x104d92be4 main (AppDelegate.swift:15)
22 libdyld.dylib                  0x182ace56c start

不知道有没有办法隐藏新的工具栏?

===== 2017 年 11 月 19 日编辑

添加了显示新工具栏的屏幕截图:

一旦 selectedCalendars 留空,就会显示新的工具栏。一旦点击[显示全部]按钮,就会发生崩溃。

我遇到了同样的错误,并发现了一种奇怪但非常有效的解决方法。事实证明,如果在呈现视图控制器之前清除选定的日历集,工具栏就会消失,从而防止崩溃。

calendarChooser.selectedCalendars = Set();