Expo Calendar alarms issue

435 Views Asked by At

I'm trying to add Event in calendar with an alarm 1hour before. I'm using Expo-calendar (ios simulator iOs 13)

Here is my configuration :

 Expo CLI 3.22.0 environment info:
        System:
          OS: macOS Mojave 10.14.6
          Shell: 5.3 - /bin/zsh
        Binaries:
          Node: 10.16.3 - /usr/local/bin/node
          npm: 6.14.5 - /usr/local/bin/npm
        IDEs:
          Android Studio: 4.0 AI-193.6911.18.40.6514223
          Xcode: 11.0/11A420a - /usr/bin/xcodebuild
        npmPackages:
          expo: ~36.0.0 => 36.0.2 
          react: ~16.9.0 => 16.9.0 
          react-dom: ~16.9.0 => 16.9.0 
          react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 
          react-native-web: ~0.11.7 => 0.11.7 
          react-navigation: ^4.0.10 => 4.0.10 
        npmGlobalPackages:
          expo-cli: 3.22.0

I save the event when a user clicks on a button, here is my main function :

The calendar creation works / the event creation (without alarm) works

addEventCalendar = async (itemEventData) => {
        console.log('add event');

        const { status } = await Calendar.requestCalendarPermissionsAsync();
        if (status === 'granted') {

            //creation du calendrier
            let appCurrCalendar = await this.getAppCalendarSource();
            console.log(' ----- ');
            console.log(' appCurrCalendar : ' + JSON.stringify(appCurrCalendar));
            console.log(' ----- ');
            let currCalendarId;

            if (appCurrCalendar === undefined) {
                console.log('no cal --> create');
                currCalendar = await this.createCalendar();

                console.log('new cal id = ' + JSON.stringify(currCalendar));

                currCalendarId = currCalendar;

            } else {
                console.log(' cal  --> Trouvé');
                console.log(' cal title = ' + appCurrCalendar.title + " --> id : " + appCurrCalendar.id);
                currCalendarId = appCurrCalendar.id;
            }


            var detailsEvent = {
                title: itemEventData.titre_flyer,
                startDate: moment(itemEventData.event_date + " " + itemEventData.event_hdeb).format("YYYY-MM-DD[T]HH:mm:ss.sssZ"),
                endDate: moment(itemEventData.event_date + " " + itemEventData.event_hfin).format("YYYY-MM-DD[T]HH:mm:ss.sssZ"),
                timeZone: Localization.timezone,

                location: itemEventData.lib_agence + " " + itemEventData.adresse_agence + " - " + itemEventData.ville_agence + " " + itemEventData.cp_agence
            }

            

            var idEvent = await Calendar.createEventAsync(currCalendarId, detailsEvent).catch((error) => console.log("ERROR create EVENT  >>> " + JSON.stringify(error)));


            console.log('event created : OK');
            console.log('event created : ' + JSON.stringify(idEvent));

            /************* IF I TRY TO ADD AN ALARM APP CRASHED *******************/
            /*
            console.log('event update start ');

            await Calendar.updateEventAsync(idEvent, {
                alarms: [{ relativeOffset: -60 } ],  //reminder 60 minutes before
                timeZone: Localization.timezone
            }).catch((error) => console.log("ERROR update Event  >>> " + JSON.stringify(error)));

            console.log('event update end ');
            */
            /************* IF I TRY TO ADD AN ALARM APP CRASHED *******************/
            }
        }

I read a lot of forums but didn't undestand why... App crashed on alarms update.

this is the error response :

    ERROR update Event  >>> 
{"framesToPop":1,
"code":"E_EXC",
"message":"An exception was thrown while calling `ExpoCalendar.saveEventAsync` with arguments `(\n        {\n        alarms =         {\n            0 =             {\n                relativeOffset = \"-60\";\n            };\n        };\n        id = \"63E3B10F-34B8-4278-8C0A-16D7D1FF1AE2\";\n        timeZone = \"Europe/Paris\";\n    },\n        {\n        futureEvents = 0;\n    }\n)`: 
-[NSTaggedPointerString count]: unrecognized selector sent to instance 0x93bc687b12d20e75",
"nativeStackIOS":["0   Exponent                            0x000000010af7f71b ABI36_0_0RCTJSErrorFromCodeMessageAndNSError + 79",
"1   Exponent                            0x000000010af3c36f __50-[ABI36_0_0RCTModuleMethod processMethodSignature]_block_invoke_2.103 + 97",
"2   Exponent                            0x000000010affae7f __88-[ABI36_0_0UMNativeModulesProxy callMethod:methodNameOrKey:arguments:resolver:rejecter:]_block_invoke + 163",
"3   libdispatch.dylib                   0x00007fff511fb888 _dispatch_call_block_and_release + 12",
"4   libdispatch.dylib                   0x00007fff511fc7f9 _dispatch_client_callout + 8",
"5   libdispatch.dylib                   0x00007fff51202566 _dispatch_lane_serial_drain + 707",
"6   libdispatch.dylib                   0x00007fff51202f9c _dispatch_lane_invoke + 388",
"7   libdispatch.dylib                   0x00007fff5120d06c _dispatch_workloop_worker_thread + 626",
"8   libsystem_pthread.dylib             0x00007fff5141c611 _pthread_wqthread + 421",
"9   libsystem_pthread.dylib             0x00007fff5141c3fd start_wqthread + 13"],
"domain":"ABI36_0_0RCTErrorDomain",
"userInfo":null}


       
1

There are 1 best solutions below

0
y00gi On

[SOLVED] Everything is working fine after :

-> UPDATE to Expo 37.0.0

expo update 37.0.0

-> UPDATE expo-calendar to 8.2.1

npm install --save [email protected]