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.

App crash on fetchAllEvents

See original GitHub issue

App crashes when I want to get all events using fetchAllEvents. Most of the library methods work but when I want to use this method app will crash on android.

Environment

React Native Environment Info: System: OS: macOS 10.14 CPU: (4) x64 Intel® Core™ i5-3210M CPU @ 2.50GHz Memory: 33.83 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.11.1 - /usr/local/bin/node Yarn: 1.12.3 - /usr/local/bin/yarn npm: 5.8.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 Android SDK: API Levels: 23, 26, 27, 28 Build Tools: 27.0.0, 27.0.1, 27.0.3, 28.0.3 System Images: android-23 | Google APIs Intel x86 Atom_64 IDEs: Android Studio: 3.0 AI-171.4408382 Xcode: 10.0/10A255 - /usr/bin/xcodebuild npmPackages: react: 16.6.1 => 16.6.1 react-native: 0.57.5 => 0.57.5 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7

Steps to Reproduce

async checkCalendar() {
  // date = this.state.selectedStartDate.toISOString()
  date = '2018-12-09T12:21:27.873Z'
  date1 = '2018-12-10T12:21:27.873Z'
 RNCalendarEvents.authorizeEventStore()

  // console.log(date)
  try{
  cals = await RNCalendarEvents.findCalendars()
  console.log(cals)
  }
  catch(e) {
    console.log(e)
  }
  try{
    console.log('fetchAllEvents')
  c = await RNCalendarEvents.fetchAllEvents(date,date1,cals)

  console.log(c)

  }
  catch(e){
    console.log(e)
  }
  
}

Expected Behavior

I want to list events that exist in my calendar.

Actual Behavior

App will crash at this line: RNCalendarEvents.fetchAllEvents(date,data1,cals)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
dophlincommented, Jun 6, 2019

I use this method in order to solve my problem:

    fetchAllEvents(startDate, endDate, calendarId) {
        if (Platform.OS !== 'android') {
            const startD = moment.utc(startDate).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
            const endD = moment.utc(endDate).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
            return RNCalendarEvents.fetchAllEvents(startD, endD, [calendarId]);
        } else {
            return RNCalendarEvents.fetchAllEvents(startDate, endDate, [calendarId]);
        }
    }

I hope it helps.

0reactions
ricbermocommented, Apr 9, 2021

For future readers and date-fns users: use formatRFC3339 like this startDate = formatRFC3339(date, {fractionDigits: 3}),

Read more comments on GitHub >

github_iconTop Results From Across the Web

app crash on iOS 16.1(beta) when u… - Apple Developer
My app was built with XCode13 and we are now seeing occasional crashes on iOS16.1 (beta). This exception occurs when using the method:....
Read more >
react-native-calendar-events - npm
React Native Calendar Events. npm. A React Native module to help access and save events to iOS and Android calendars.
Read more >
Why is my app crashing? - Ford
If you experience issues with the FordPass® App crashing, ensure the following requirements are met:Confirm that your device is compatible with the app....
Read more >
What do I do if the Dropbox iOS app crashes?
If the Dropbox mobile app freezes or crashes for some reason, try these troubleshooting steps. If the Dropbox desktop application crashes, visit this ......
Read more >
iOS App Crashes from Memory Issue when Generating ...
Don't try to convert the PHAsset to UIImage and store in array. Because UIImage will use the full memory size of the image....
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