gpt4 book ai didi

javascript - Calendar.createEventAsync 仅在 Android 博览会上崩溃

转载 作者:行者123 更新时间:2023-12-02 23:23:57 24 4
gpt4 key购买 nike

我正在尝试将事件添加到设备的日历中,在 iOS 上它运行完美,但在 Android 上,应用程序崩溃并且出现此错误。

    22956/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #6
Process: …., PID: 22713
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at expo.modules.calendar.CalendarModule.createRemindersForEvent(CalendarModule.java:869)
at expo.modules.calendar.CalendarModule.saveEvent(CalendarModule.java:751)
at expo.modules.calendar.CalendarModule.access$500(CalendarModule.java:34)
at expo.modules.calendar.CalendarModule$6.run(CalendarModule.java:161)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:257)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)”

这是我的代码:

   let isoFormattedStartDate = moment(event.eventStartDate).toISOString();
let isoFormattedEndDate = moment(event.eventEndDate).toISOString();

Calendar.createEventAsync(Calendar.DEFAULT, {
title: name,
startDate: isoFormattedStartDate,
endDate: isoFormattedEndDate,
location: location,
timeZone: "GMT+1",
alarms: [{relativeOffset: -1}, {relativeOffset: -1440}]
})
.then((event) => {
console.log("Calendar.createEventAsync success: ", event);
Alert.alert("Added To Calendar");
})
.catch((error) => {
console.log("Calendar.createEventAsync failure: ", error);
});

Package.json

"dependencies": {
"expo": "33.0.7",
"expo-calendar": "~5.0.1",
"expo-cli": "^2.19.5",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",

... },

我不知道为什么它只在 Android 上崩溃。任何帮助将不胜感激!谢谢

最佳答案

修复就在这里。

https://github.com/expo/expo/pull/5134

我们预计会在 expo SDk 35 中修复该问题。

关于javascript - Calendar.createEventAsync 仅在 Android 博览会上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56821645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com