Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EKEventViewController doesn't show event details

I'm currently working in iOS11b6 and the section of my code to open an event in EKEventViewController doesn't show event details - it just shows 'New Event', 'January 1, 2001', 'Untitled Calendar'.

The section of my code to display the event is below (works fine in iOS10)

func openEvent() {
    eventIdentifier = eventClipboardIdentifier

    let eventViewController = EKEventViewController.init()
    eventViewController.event = self.getEventFromEventClipboard()
    print(eventViewController.event.title)

    eventViewController.delegate = self
    eventViewController.allowsCalendarPreview = false
    eventViewController.allowsEditing = true

    let navBar = UINavigationController(rootViewController: eventViewController)
    print(eventViewController.event.title)

    present(navBar, animated: true, completion: nil)
}

The error I am getting in Xcode debugger is below.

2017-08-20 20:25:48.001329+1000 CalendarApp[1113:281191] *** -[__NSCFCalendar components:fromDate:]: date cannot be nil
Future exception.
A few of these errors are going to be reported with this complaint, then further violations will simply be ignored.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):

The last print command is to verify the event is hitting the eventViewController and it is all looking OK.

When I 'edit' the event in the EKEventViewController (with the incorrect information), the EKEventViewController loads correctly.

I had a look at beta documentation and can't find any information about EKEventViewController.

Any ideas?

like image 238
Andrew Varvel Avatar asked Aug 20 '17 10:08

Andrew Varvel


1 Answers

I now believe this to be an iOS11 bug.

Changing allowsCalendarPreview to true will show the event correctly.

like image 141
Andrew Varvel Avatar answered Nov 12 '22 09:11

Andrew Varvel