question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't add attendees to event.

See original GitHub issue

I wanted to save event with attendees but my App is crashing when I am trying to add them. Event is saved successfully without attendees key.

This is the error I got in Android Studio.

com.facebook.react.bridge.NoSuchKeyException: url at com.facebook.react.bridge.ReadableNativeMap.getType(ReadableNativeMap.java:225) at com.calendarevents.CalendarEvents.createAttendeesForEvent(CalendarEvents.java:772) at com.calendarevents.CalendarEvents.addEvent(CalendarEvents.java:667) at com.calendarevents.CalendarEvents.access$200(CalendarEvents.java:44) at com.calendarevents.CalendarEvents$3.run(CalendarEvents.java:1225) at java.lang.Thread.run(Thread.java:919)

Environment

React Native Environment Info: System: OS: macOS 10.14.3 CPU: (4) x64 Intel® Core™ i5-5350U CPU @ 1.80GHz Memory: 17.86 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.0.0 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 23, 25, 27, 28, 29 Build Tools: 27.0.3, 28.0.2, 28.0.3 System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.2/10E125 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: ^0.59.1 => 0.59.1 npmGlobalPackages: react-native-cli: 2.0.1

Steps to Reproduce

let calevent = await RNCalendarEvents.saveEvent(eventTitle, { calendarId: this.state.calId, startDate: from_date, endDate: to_date, location: eventLocation, alarms: [{ date: 60 }], attendees: [{name: “User Name”, email: “user@email.com”}] });

Expected Behavior

I think there should be an option to add attendees while saving or updating an event. I tried both with no luck.

Actual Behavior

App crashing when I try to add attendees.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
padabalacommented, Feb 26, 2020

Adding attendees as attendees: [{name: "User Name", email: "user@email.com"}] is not working because when i gone through the android native java files in library I see different keys are expected for objects in attendees array.

library version I used: 1.7.3 File: react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java

`//region Attendees private void createAttendeesForEvent(ContentResolver resolver, int eventID, ReadableArray attendees) { … some logic

    for (int i = 0; i < attendees.size(); i++) {
        ReadableMap attendee = attendees.getMap(i);
        ReadableType type = attendee.getType("url");
        ReadableType fNameType = attendee.getType("firstName");
        if (type == ReadableType.String) {
            ContentValues attendeeValues = new ContentValues();
            attendeeValues.put(CalendarContract.Attendees.EVENT_ID, eventID);
            attendeeValues.put(CalendarContract.Attendees.ATTENDEE_EMAIL, attendee.getString("url"));
            attendeeValues.put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP, CalendarContract.Attendees.RELATIONSHIP_ATTENDEE);

            if (fNameType == ReadableType.String) {
                attendeeValues.put(CalendarContract.Attendees.ATTENDEE_NAME, attendee.getString("firstName"));
            }
            resolver.insert(CalendarContract.Attendees.CONTENT_URI, attendeeValues);
        }
    }
}
//endregion`

So it is expecting url and firstName as keys instead of name and email in each attendee object passed in array.

I tested with the following object and it worked on Android:

title = 'test event';
details = {
    id: <event.id>,
    ......
    ......
    attendees:[
            {'url':'<email>', 'firstName': '<name>'},
            {'url':'<email>', 'firstName': '<name>'},
            {'url':'<email>', 'firstName': '<name>'}
   ]
}
RNCalendarEvents.saveEvent(title, details)

iOS: Doesn’t even parse attendees array in saving event method mentioned in file RNCalendarEvents.m

And they also mentioned attendees as read only in the documentation of this library.

0reactions
padabalacommented, Oct 12, 2020

Adding attendees as attendees: [{name: "User Name", email: "user@email.com"}] is not working because when i gone through the android native java files in library I see different keys are expected for objects in attendees array. library version I used: 1.7.3 File: react-native-calendar-events/android/src/main/java/com/calendarevents/CalendarEvents.java `//region Attendees private void createAttendeesForEvent(ContentResolver resolver, int eventID, ReadableArray attendees) { … some logic

    for (int i = 0; i < attendees.size(); i++) {
        ReadableMap attendee = attendees.getMap(i);
        ReadableType type = attendee.getType("url");
        ReadableType fNameType = attendee.getType("firstName");
        if (type == ReadableType.String) {
            ContentValues attendeeValues = new ContentValues();
            attendeeValues.put(CalendarContract.Attendees.EVENT_ID, eventID);
            attendeeValues.put(CalendarContract.Attendees.ATTENDEE_EMAIL, attendee.getString("url"));
            attendeeValues.put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP, CalendarContract.Attendees.RELATIONSHIP_ATTENDEE);

            if (fNameType == ReadableType.String) {
                attendeeValues.put(CalendarContract.Attendees.ATTENDEE_NAME, attendee.getString("firstName"));
            }
            resolver.insert(CalendarContract.Attendees.CONTENT_URI, attendeeValues);
        }
    }
}
//endregion`

So it is expecting url and firstName as keys instead of name and email in each attendee object passed in array. I tested with the following object and it worked on Android:

title = 'test event';
details = {
    id: <event.id>,
    ......
    ......
    attendees:[
            {'url':'<email>', 'firstName': '<name>'},
            {'url':'<email>', 'firstName': '<name>'},
            {'url':'<email>', 'firstName': '<name>'}
   ]
}
RNCalendarEvents.saveEvent(title, details)

iOS: Doesn’t even parse attendees array in saving event method mentioned in file RNCalendarEvents.m And they also mentioned attendees as read only in the documentation of this library.

were you able to find a solution for IOS. perhaps any other library that works well with both android and ios?

Here it is. https://github.com/padabala/react-native-calendar-events.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why can't I add invitees on my calendar on my iPhone 6s?
I'm trying to add someone to an event on my calendar and the invitee option is no longer there? Is this something that's...
Read more >
Can't add attendees when creating a meeting
Hello I've created a team/channels in Teams but when i try to schedule a meeting and add required attendees, no one shows in...
Read more >
iPhone 12: How to Add Invitees to Your Calendar ... - YouTube
Learn how you can add invitees to your calendar event and how to share it out on the iPhone 12 ... Your browser...
Read more >
Can not add invitees to a calendar event after the event has ...
I solved the issue of not being able to add an invitee by exporting all my appointments and creating a new iCloud Calendar....
Read more >
Add attendees manually | Eventbrite Help Center
Before you start. ☑️ Manually adding attendees won't process credit or debit cards. · 1. Go to your Event Dashboard. · 2. Go...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found