ios11 - iOS 11 在 EventKitUI 上崩溃 -[EKCalendarChooser _selectAllCalendarsAndStores :]

标签 ios11 eventkit

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

当点击 iOS 11 的 EKCalendarChooser 类的新工具栏上的 [显示全部] 按钮时,会发生崩溃,但当其选择样式设置为 .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留空,就会显示新的工具栏。一旦点击[显示全部]按钮,就会发生崩溃。

enter image description here

最佳答案

我遇到了同样的错误,并发现了一种奇怪但令人惊讶的有效方法来解决它。事实证明,如果您在呈现 View Controller 之前清除选定的日历集,工具栏就会消失,从而防止崩溃。

calendarChooser.selectedCalendars = Set();

关于ios11 - iOS 11 在 EventKitUI 上崩溃 -[EKCalendarChooser _selectAllCalendarsAndStores :],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46699378/

相关文章:

ios - 权限添加日历事件iOS

objective-c - 如何使用EventKit Framework提前一年设置提醒

storyboard - 我可以在 iOS 11 中通过 Storyboard 添加 PDFView

swift - jsqmessagesviewcontroller inputToolBar IOS 11 iphone X Swift4

ios - 获取一个 UITableView 以在标题顶部加载

uitableview - 调用 self.tableView.reloadData 需要 10-15 秒

iphone - 如何从 iPhone 应用程序中启动 iPhone 日历?

html - ios 11 Beta 5 选择下拉列表问题

ios11 - 应用程序加载程序突然不接受我的 AppleID

ios - 我想禁用 EKEventEditViewController 的 URL 和 NOTES 字段