7

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?

Lësha Turkowski
  • 1,361
  • 1
  • 10
  • 21
Andrew Varvel
  • 1,286
  • 1
  • 10
  • 19
  • Look here: https://stackoverflow.com/questions/26760014/nscfcalendar-componentsfromdatetodateoptions-fromdate-cannot-be-nil – ctatti Aug 20 '17 at 12:52
  • Thanks for the link @thestubborndev - I checked the start and endDate of the event and they are both valid by logging the entire event (eventViewController.event). – Andrew Varvel Aug 20 '17 at 21:07

1 Answers1

1

I now believe this to be an iOS11 bug.

Changing allowsCalendarPreview to true will show the event correctly.

Andrew Varvel
  • 1,286
  • 1
  • 10
  • 19