Giter VIP home page Giter VIP logo

Comments (4)

richardtop avatar richardtop commented on August 22, 2024

Most likely, there is a missing reloadData call here: https://github.com/richardtop/CalendarApp/blob/master/Calendar/CalendarViewController.swift#L28

Also, you might need to re-subscribe to the EventStore updates, i.e. invoke this method again:
https://github.com/richardtop/CalendarApp/blob/master/Calendar/CalendarViewController.swift#L32
Let me know, if any of these suggestions improve the situation and feel free to submit a pull request.

I don't think the CK version matters here, since it's clearly an error in the CalendarApp.

from calendarapp.

niklasgrewe avatar niklasgrewe commented on August 22, 2024

thanks, i tried the following, using the package SPPermissions:

override func viewDidLoad() {
    super.viewDidLoad()
    title = "Calendar"
    navigationController?.view.backgroundColor = .systemGray6
    
    if !SPPermissions.Permission.calendar.authorized {
        requestAccessToCalendar()
    } else {
        subscribeToNotifications()
    }
}

my requestAccessToCalendar() function looks like this:

func requestAccessToCalendar() {
    let permissions: [SPPermissions.Permission] = [.calendar]
    let controller = SPPermissions.dialog(permissions)
    controller.delegate = self
    controller.present(on: splitViewController ?? self)
}

and i implement the callback function like this:

extension CalendarController: SPPermissionsDelegate {
    func didAllowPermission(_ permission: SPPermissions.Permission) {
        reloadData()
        subscribeToNotifications()
    }
}

When i run my app, everthing works without crashing, but i get the following messages in console:

[EventKit] Error (1013) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 1/3
[EventKit] Error (1013) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 2/3
[EventKit] Error (1013) in reply block for CADDatabaseFetchCalendarItemsWithPredicate attempt 3/3
[EventKit] All retries exhausted for CADDatabaseFetchCalendarItemsWithPredicate

from calendarapp.

niklasgrewe avatar niklasgrewe commented on August 22, 2024

it's a bug. After Permission is granted, you need to create an new EKEventStore() like this:

extension CalendarController: SPPermissionsDelegate {
    func didAllowPermission(_ permission: SPPermissions.Permission) {
        eventStore = EKEventStore() // --> create a new Instance
        reloadData()
        subscribeToNotifications()
    }
}

from calendarapp.

richardtop avatar richardtop commented on August 22, 2024

Keeping this open, until I fix this. But if you'd like, I'd appreciate the pull request fixing this issue. Thanks for the investigation!

from calendarapp.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.