builttoroam / device_calendar

A cross platform plugin for modifying calendars on the user's device
https://pub.dev/packages/device_calendar
BSD 3-Clause "New" or "Revised" License
267 stars 267 forks source link

iOS: Fix error when adding attendees due to UUID is nil. #453

Closed GoldenSoju closed 1 year ago

GoldenSoju commented 1 year ago

I recently had several crashes on my app (iOS users) and found out that the adding attendee functionality was broken.

Error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil'

I was able to locate the error in the SwiftDeviceCalendarPlugin.swift file (line 692):

ekEvent!.setValue(attendees, forKey: "attendees")

And adding the line below to the createParticipant in the same file solved the problem. Thanks to this solution.

participant.setValue(UUID().uuidString, forKey: "UUID")

Besides that I

IVLIVS-III commented 1 year ago

Looks good on first glance, thanks. Will hopefully have time to do a proper review in the coming days.