Я пытаюсь добавить событие в календарь с будильником за 1 час до этого. Я использую Expo-Calendar (ios simulator iOs 13)
Вот моя конфигурация:
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
Я сохраняю событие, когда пользователь нажимает кнопку, здесь это моя основная функция:
Работает создание календаря / работает создание событий (без будильника)
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 *******************/
}
}
Я читал много форумов, но не понял почему ... Приложение вылетело при обновлении сигналов тревоги.
это ответ на ошибку:
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}