Others and I are having problems with our local offline USB synchronizing our calendars in the recent macOS versions (started in Ventura) and iP* devices as shown in these links:
https://talk.tidbits.com/t/my-mac-apple-calendar-went-berserk-i-need-help/23878/39
https://discussions.apple.com/thread/254982807
https://discussions.apple.com/thread/254549186
https://discussions.apple.com/thread/254463571
https://discussions.apple.com/thread/254650642
https://discussions.apple.com/thread/254890299
https://discussions.apple.com/thread/254876661
etc.
We reported this to Apple too with our bug reports, but nothing. We don't want to use clouds too.
Thank you for reading and hopefully answering.
EventKit
RSS for tagCreate, view, and edit calendar and reminder events using EventKit and EventKitUI. Request read-only, write-only, or full-access to Calendar data.
Posts under EventKit tag
27 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I want to find the "last Sunday of a month before the current date" in Swift, but using the Calendar nextDate function doesn't work (always returns nil).
var calendar: Calendar = Calendar(identifier: .gregorian)
calendar.timeZone = .gmt
let lastSundayDateComponents: DateComponents = DateComponents(
weekday: 1,
weekdayOrdinal: -1
)
let previousLastSundayDate: Date? = calendar.nextDate(
after: Date.now,
matching: lastSundayDateComponents,
matchingPolicy: .nextTime,
repeatedTimePolicy: .first,
direction: .backward
)
print(previousLastSundayDate ?? "Not found") // "Not found"
If I use a positive weekdayOrdinal, it's working normally and the same nextDate method provides the correct date.
let firstSundayDateComponents: DateComponents = DateComponents(
weekday: 1,
weekdayOrdinal: 1
)
When I check if the date components can provide a valid date for the given calendar, it returns false...
let lastSundayInNovember2023DateComponents: DateComponents = DateComponents(
year: 2023,
month: 11,
weekday: 1,
weekdayOrdinal: -1
)
// THIS RETURNS FALSE
let isValid: Bool = lastSundayInNovember2023DateComponents.isValidDate(in: calendar)
print(isValid) // false
... even if the correct date can be created.
let lastSundayInNovember2023: Date = calendar.date(from: lastSundayInNovember2023DateComponents)!
print(lastSundayInNovember2023) // 2023-11-26 00:00:00 +0000
Is that a bug in Foundation?
Hi,
I am evaluating the write ony mode and on my Development iPhone (14 Max Pro / 17.2) I get an error when trying to add an event in write only access mode.
I am using the provided snippet
let store = EKEventStore()
// Request write-only access
guard try await store.requestWriteOnlyAccessToEvents() else { return }
// Create an event
let event = EKEvent(eventStore: store)
event.calendar = store.defaultCalendarForNewEvents
event.title = "WWDC23 Keynote"
event.startDate = myEventStartDate
event.endDate = myEventEndDate
event.timeZone = TimeZone(identifier: "America/Los_Angeles")
event.location = "1 Apple Park Way, Cupertino, CA, United States"
event.notes = "Kick off an exhilarating week of technology and community."
// Save the event
guard try eventStore.save(event, span: .thisEvent) else { return }
On the .save step I receive the following Error ("The calendar is read only")
Failed to save event: Error Domain=EKErrorDomain Code=6 "Der Kalender ist schreibgeschützt." UserInfo={NSLocalizedDescription=Der Kalender ist schreibgeschützt.}
Changing the premission to Full Access makes the snippet work.
I tested with iCloud and CalDav Accounts. Both fail.
Does anyone have similiar problems? Or a solution to this? It seems like a bug to me.
I want to create a list in the Reminders app using EventKit. For each created list, I want to create EKReminders. However, it seems that EventKit does not provide a way to create a reminder list directly. How can I achieve this?
I have experienced a strange issue on my iphone test device. (iPhone Xr running iOS 17.0.3)
In my app I ask a user for calendar full access. Once I gave the access permission, the app works as expected. Then somehow the status changed from .fullAccess to .denied. This happens without my interaction in iPhone's Settings. I have doubled checked in Settings app and the permission is still granted. But somehow the status is denied when calling EKEventStore.authorizationStatus(for: .reminder)
Regardless of how bad my code is, the app should not be able to change status from .fullAccess to .denied. Correct?
I have never had this problem until lately. But it happens to both my iOS app and my mac Catalyst app. Which is really strange. (iOS 17.0.3 and Sonoma 14.0)
This problem doesn't happen all the time though. Most of the time my app works fine. But it can happen few times per day. And even more strange, it tends to happen at the same time for iOS and macOS.
I don't know if this problem happens to me because of the fact that I install/uninstall the app many times but currently it just causes me a headache.
I have attached 2 images. These 2 images happen at the same time. The only fix is that I have to turn off then turn on the Full Access again in Settings app. Something for Reminder.
Any advice is much appreciated. Thank you.
Hi, I am facing a problem related to the API in the title.
When the API is executed with EKAuthorizationStatus notDetermined, the dialog is not displayed and (false, nil) is passed to completion.
// Create an event store
let store = EKEventStore()
store.requestWriteOnlyAccessToEvents { granted, error in
if let error {
print("error occurred")
} else if granted {
print("allowed")
} else {
print("denied")
}
}
// "denied"
That is why I am not sure what is causing the dialog not to appear.
Is this a bug in the API?
note
This is not a problem in the simulator. It is a problem **only on the actual device.
development environment
Xcode Version 15.0 (15A240d)
iPhone SE(3rd) iOS 17.0.2 (21A351)
We use Eventkit Framework to synchronize the meeting calendar to the system calendar, read the System Calendar with -[EKEventStore calendarsForEntityType:], Use - [EKEventStore saveEvent: span: commit: error:] wrote system calendar. This usage currently triggers the Contacts Permission Alert on a user. Through the log, we identified no use - [CNContactStore requestAccessForEntityType: completionHandler:] and Contacts API.