EventKit

RSS for tag

Create, 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

142 Posts

Post

Replies

Boosts

Views

Activity

Query: Creating a virtual conference event from the main target of the iOS app.
Hello, I've implemented my Virtual conference extension and my app shows up without issues in the Calendar app and displays our app with a Join button and it all works great!. However, when creating an event from the main target of the app using EventKitUI with the help of EKEventEditViewController and an EKEvent instance, the event does not display as if it were a virtual conference. I see a few other apps like Zoom have implemented this and I'm having trouble finding the related documents on how to link a programtically created event with a virtual conference. Any help or pointers on how to achieve this is highly appreciated. Thanks!
1
1
927
Oct ’23
-[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:]: Called off the main thread. CoreFoundation __exceptionPreprocess
iPad Pro 12.9 、iOS15.4 (21E230) #700003 NSInternalInconsistencyException -[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:]: Called off the main thread. CoreFoundation __exceptionPreprocess CoreFoundation __exceptionPreprocess + 220 2 Foundation -[NSCalendarDate initWithCoder:] + 0 3 UIKitMacHelper -[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:] + 504 4 UIKitMacHelper -[UINSUIKitBackgroundingController transitionUIAppThroughBackgroundStateIfNecessary] + 144 5 UIKitMacHelper -[UINSApplicationLifecycleController transitionAppThroughBackgroundState] + 308 6 UIKitMacHelper -[UINSApplicationDelegate _toggleAppForegroundStateIfAppStoreURL:] + 276 7 UIKitMacHelper __54-[UINSApplicationDelegate openURL:options:completion:]_block_invoke_2 + 196 8 AppKit _NSWorkspaceHandleLSOpenResult + 164 9 LaunchServices _LSFireCompletionHandler(void (__LSASN const*, unsigned char, __CFError*) block_pointer, NSURL*, NSURL*, NSDictionary<NSString*, objc_object*>, objc_object, bool, NSError*) + 200 10 LaunchServices _LSOpenAsyncCommonDispatched(objc_object*, NSArray<NSURL*>, NSURL, objc_object*, NSDictionary<NSString*, objc_object*>, NSObject<OS_dispatch_semaphore>, void (__LSASN const*, unsigned char, __CFError*) block_pointer) + 5732 11 libdispatch.dylib _dispatch_call_block_and_release + 32 17 libsystem_pthread.dylib start_wqthread + 8 #0 Thread 0 libsystem_kernel.dylib mach_msg_trap + 8 4 CoreFoundation CFRunLoopRunSpecific + 600 5 HIToolbox RunCurrentEventLoopInMode + 292 6 HIToolbox ReceiveNextEventCommon + 564 7 HIToolbox _BlockUntilNextEventMatchingListInModeWithFilter + 72 8 AppKit _DPSNextEvent + 860 9 AppKit -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328 10 AppKit -[NSApplication run] + 596 11 AppKit NSApplicationMain + 1132 12 AppKit +[NSWindow _savedFrameFromString:] + 0 13 UIKitMacHelper UINSApplicationMain + 1276
1
0
1.1k
Sep ’23
Linking StartView with ContentView
Hello everyone, I'm attempting to incorporate a button in my StartView that will lead directly to ContentView without the intermediate step of using a navigation view. I want StartView to seamlessly transition into ContentView. Thank you very much in advance! import SwiftUI struct StartView: View { @State private var isQuizStarted = false @Environment(.presentationMode) var presentationMode var body: some View { VStack { Text("Radiology Core Prep Q&A") .font(.headline) .padding() Image("cxr") .resizable() .aspectRatio(contentMode: .fit) .frame(height: 325) } } } struct StartView_Previews: PreviewProvider { static var previews: some View { StartView() } }
0
0
726
Sep ’23
default calendar for new event in iOS17
It looks like the delegate function eventEditViewControllerDefaultCalendar(forNewEvents controller: EKEventEditViewController) -> EKCalendar of the EKEventEditViewDelegate protocol is not called in iOS 17 anymore. The app does have the new NSCalendarsFullAccessUsageDescription key set and full access is granted. Is this the intended behaviour for iOS 17? Does anybody else have the same problem?
1
1
1k
Sep ’23
Open Mac Calendar on specific date
I have an app that has lots of booking dates. I need a quick way to open the Mac Calendar on the date of the booking just so the user can cross check the dates for clashes. At this stage, I don't need to build UI into my app that shows the dates. What is already in Calendar is sufficient - don't reinvent the wheel. A long time ago, calshow seemed to be the way to do this. But that seems to have withered away. Opening a URL with ical:// opens calendar, but not at the date required since there seems to be no URL scheme defined. I could query Event Kit, but that means building unnecessary UI at this time. There's possibly a way to do this with Scripting Bridge and probably a way to do this with a call to an AppleScript. Is there no simpler way to do this in 2023 on a Mac?
0
2
1.3k
Sep ’23
Request Reminders Access
So I'm looking to add a button to my app that would create and fill a reminder in the user's Reminders app, but I've found that I first need to request access to the user's Reminders app data. I've also found the way to do that has been changed with iOS 17 as explained here: https://developer.apple.com/documentation/eventkit/ekeventstore/4162273-requestfullaccesstoreminders How do I use this function so that the prompt requesting for access to the user's Reminders app pops up at the launch of the app every time unless they've previously given permission? Also what would be the function to create the reminder once I do have permissions? This is the code ChatGPT gave me to do so, but I just keep getting "Failed to create Reminder URL". func createReminder() { let reminderTitle = "Cocktail Groceries" var subtaskStrings: [String] = [] for ingredient in shoppingList { subtaskStrings.append(ingredient) } let subtasks = subtaskStrings.map { (ingredient) -> [String: Any] in return [ "title": ingredient, "completed": false ] } let reminderData: [String: Any] = [ "title": reminderTitle, "subtasks": subtasks ] if let reminderURL = createURL(for: "x-apple-reminder://", with: reminderData) { UIApplication.shared.open(reminderURL) } else { print("Failed to create Reminder URL") } } Also I intend on expanding this function to the notes app. But im taking one step at a time. Any help would be GREATLY appreciated. Thanks!
0
0
1.3k
Sep ’23
EventKit on Vision Pro
How do I access the user's reminders on Vision Pro? When I use the same code from iOS with EventKit, the reminders and reminder lists are empty. Is the way to access reminders the same on VisionOS as it is on iOS, iPadOS, and macOS? Or is there a new framework? Thanks.
0
0
920
Sep ’23
Cannot modify title of Event in Calendar
Hi, I'm creating a calendar application. I am using the EKeventEditViewController to add events to my application. The problem is that the title of the sheet cannot be modified. When I change a title, the console shows that the title has changed. However, the simulator still displays the previous title; "New Event". How can I fix it? void (^showEventEditingController)(EKEvent *) = ^(EKEvent * event){ EKEventEditViewController *controller = [[EKEventEditViewController alloc] init]; controller.event = event; controller.eventStore = [self getEventStoreInstance]; controller.editViewDelegate = self; NSLog(@"%@", controller.title); // "New Event" controller.title = @"My Custom title"; NSLog(@"%@", controller.title); // "My Custom title" [self assignNavbarColorsTo:controller.navigationBar]; [self presentViewController:controller]; NSLog(@"%@", controller.title); // "My Custom title" };
1
0
981
Aug ’23
add EKAttendee on EKEvent, but happen crash issue on iOS16.4
on iOS16.4, if try to add EKAttendee on EKEvent, it will cause app crash; this can not reproduce on iOS14.5/iOS15.7 etc low version. Add Main example Attendee code: Class className = NSClassFromString(@"EKAttendee"); NSMutableArray *attendeessystem = [NSMutableArray new]; for(int i=0; I<1;i++){ id attendee = [className new]; [attendee setValue:@"test" forKey:@"firstName"]; [attendee setValue:@"hihi" forKey:@"lastName"]; [attendee setValue:@"test@outlook.com" forKey:@"emailAddress"]; [attendeessystem addObject:attendee]; } if([attendeessystem count]>0) { [calendarEvent setValue:attendeessystem forKey:@"attendees"]; } crash log: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil' *** First throw call stack:
2
0
1.1k
Aug ’23
Deleting an event deletes the event on the iPhone calendar, but not on the MacBook one.
Hello! I receive events in this way: let store = EKEventStore() let predicate = store.predicateForEvents(withStart: startDate, end: endDate, calendars: nil) let events = store.events(matching: predicate) And remove one of them in this way: try store.remove(event, span: .thisEvent, commit: true) It removes event from iPhone's calendar, but does not from MacBook's. The event came from Google calendar. If I do these things with an event came from iCloud calendar, it works both on iPhone and MacBook. I have tried different ways to solve this problem but without success. I would appreciate any help.
2
0
1.2k
Jul ’23
iCloud Calender APi integration
Hi there, I am in the process of developing a web app using PHP, and I prefer not to use any packages or libraries. The main functionality of this app will be allowing users to create, edit, and delete calendar events. However, I am currently facing difficulties in determining the best approach to achieve this. I have been unable to find any clear resources or tutorials on how to proceed with implementing the calendar API. My question is, do I need to enroll in the Apple Developer Program to accomplish this? How can i pass authentication and make CRUD operation? I am seeking assistance from someone who can provide detailed guidance on where to start and how to proceed with implementing the calendar functionality. Thank you
0
0
1.2k
Jul ’23
How to perform an action based on the local time?
Hi! I would like to make text appear based on the local time of the user. The idea is that when it's between 00:00:01 AM and 11:00:00 AM, that the text will say "breakfast" and that when it's between 11:00:00 AM and 03:00:00 PM, the text will say "lunch". Etc. I found this code online but I can't get it working. Can you help me? Possibly with other code? . Contentview: struct Test: View { var now = Date() var breakfastTime = Date.parse("00:00:01") var lunchTime = Date.parse("11:00:00") var dinerTime = Date.parse("16:00:00") func activeDinerCourse() -> String { if now > breakfastTime && now < lunchTime { return "Breakfast" } if now > lunchTime && now < dinerTime { return "Lunch" } if now > dinerTime && now < Date.parse("23:59:59"){ return "Diner" } return "Something went wrong..." } var date = Date.now.formatted(date: .omitted, time: .shortened) var body: some View { VStack { Text("\(date)") Text(activeDinerCourse()) } } } . .Parse extention public extension Date { static func parse(_ string: String, format: String = "HH:mm:ss") -> Date { let dateFormatter = DateFormatter() dateFormatter.timeZone = NSTimeZone.default dateFormatter.dateFormat = format let date = dateFormatter.date(from: string)! return date } func dateString(_ format: String = "HH:mm:ss") -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = format return dateFormatter.string(from: self) } } . Thank you!
2
0
2.0k
Jun ’23
Query: Creating a virtual conference event from the main target of the iOS app.
Hello, I've implemented my Virtual conference extension and my app shows up without issues in the Calendar app and displays our app with a Join button and it all works great!. However, when creating an event from the main target of the app using EventKitUI with the help of EKEventEditViewController and an EKEvent instance, the event does not display as if it were a virtual conference. I see a few other apps like Zoom have implemented this and I'm having trouble finding the related documents on how to link a programtically created event with a virtual conference. Any help or pointers on how to achieve this is highly appreciated. Thanks!
Replies
1
Boosts
1
Views
927
Activity
Oct ’23
-[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:]: Called off the main thread. CoreFoundation __exceptionPreprocess
iPad Pro 12.9 、iOS15.4 (21E230) #700003 NSInternalInconsistencyException -[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:]: Called off the main thread. CoreFoundation __exceptionPreprocess CoreFoundation __exceptionPreprocess + 220 2 Foundation -[NSCalendarDate initWithCoder:] + 0 3 UIKitMacHelper -[UINSUIKitBackgroundingController _updateAppWideBackgroundStateSlammingNotifyingDelegate:] + 504 4 UIKitMacHelper -[UINSUIKitBackgroundingController transitionUIAppThroughBackgroundStateIfNecessary] + 144 5 UIKitMacHelper -[UINSApplicationLifecycleController transitionAppThroughBackgroundState] + 308 6 UIKitMacHelper -[UINSApplicationDelegate _toggleAppForegroundStateIfAppStoreURL:] + 276 7 UIKitMacHelper __54-[UINSApplicationDelegate openURL:options:completion:]_block_invoke_2 + 196 8 AppKit _NSWorkspaceHandleLSOpenResult + 164 9 LaunchServices _LSFireCompletionHandler(void (__LSASN const*, unsigned char, __CFError*) block_pointer, NSURL*, NSURL*, NSDictionary&lt;NSString*, objc_object*&gt;, objc_object, bool, NSError*) + 200 10 LaunchServices _LSOpenAsyncCommonDispatched(objc_object*, NSArray&lt;NSURL*&gt;, NSURL, objc_object*, NSDictionary&lt;NSString*, objc_object*&gt;, NSObject&lt;OS_dispatch_semaphore&gt;, void (__LSASN const*, unsigned char, __CFError*) block_pointer) + 5732 11 libdispatch.dylib _dispatch_call_block_and_release + 32 17 libsystem_pthread.dylib start_wqthread + 8 #0 Thread 0 libsystem_kernel.dylib mach_msg_trap + 8 4 CoreFoundation CFRunLoopRunSpecific + 600 5 HIToolbox RunCurrentEventLoopInMode + 292 6 HIToolbox ReceiveNextEventCommon + 564 7 HIToolbox _BlockUntilNextEventMatchingListInModeWithFilter + 72 8 AppKit _DPSNextEvent + 860 9 AppKit -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328 10 AppKit -[NSApplication run] + 596 11 AppKit NSApplicationMain + 1132 12 AppKit +[NSWindow _savedFrameFromString:] + 0 13 UIKitMacHelper UINSApplicationMain + 1276
Replies
1
Boosts
0
Views
1.1k
Activity
Sep ’23
Linking StartView with ContentView
Hello everyone, I'm attempting to incorporate a button in my StartView that will lead directly to ContentView without the intermediate step of using a navigation view. I want StartView to seamlessly transition into ContentView. Thank you very much in advance! import SwiftUI struct StartView: View { @State private var isQuizStarted = false @Environment(.presentationMode) var presentationMode var body: some View { VStack { Text("Radiology Core Prep Q&amp;A") .font(.headline) .padding() Image("cxr") .resizable() .aspectRatio(contentMode: .fit) .frame(height: 325) } } } struct StartView_Previews: PreviewProvider { static var previews: some View { StartView() } }
Replies
0
Boosts
0
Views
726
Activity
Sep ’23
default calendar for new event in iOS17
It looks like the delegate function eventEditViewControllerDefaultCalendar(forNewEvents controller: EKEventEditViewController) -> EKCalendar of the EKEventEditViewDelegate protocol is not called in iOS 17 anymore. The app does have the new NSCalendarsFullAccessUsageDescription key set and full access is granted. Is this the intended behaviour for iOS 17? Does anybody else have the same problem?
Replies
1
Boosts
1
Views
1k
Activity
Sep ’23
Open Mac Calendar on specific date
I have an app that has lots of booking dates. I need a quick way to open the Mac Calendar on the date of the booking just so the user can cross check the dates for clashes. At this stage, I don't need to build UI into my app that shows the dates. What is already in Calendar is sufficient - don't reinvent the wheel. A long time ago, calshow seemed to be the way to do this. But that seems to have withered away. Opening a URL with ical:// opens calendar, but not at the date required since there seems to be no URL scheme defined. I could query Event Kit, but that means building unnecessary UI at this time. There's possibly a way to do this with Scripting Bridge and probably a way to do this with a call to an AppleScript. Is there no simpler way to do this in 2023 on a Mac?
Replies
0
Boosts
2
Views
1.3k
Activity
Sep ’23
Request Reminders Access
So I'm looking to add a button to my app that would create and fill a reminder in the user's Reminders app, but I've found that I first need to request access to the user's Reminders app data. I've also found the way to do that has been changed with iOS 17 as explained here: https://developer.apple.com/documentation/eventkit/ekeventstore/4162273-requestfullaccesstoreminders How do I use this function so that the prompt requesting for access to the user's Reminders app pops up at the launch of the app every time unless they've previously given permission? Also what would be the function to create the reminder once I do have permissions? This is the code ChatGPT gave me to do so, but I just keep getting "Failed to create Reminder URL". func createReminder() { let reminderTitle = "Cocktail Groceries" var subtaskStrings: [String] = [] for ingredient in shoppingList { subtaskStrings.append(ingredient) } let subtasks = subtaskStrings.map { (ingredient) -> [String: Any] in return [ "title": ingredient, "completed": false ] } let reminderData: [String: Any] = [ "title": reminderTitle, "subtasks": subtasks ] if let reminderURL = createURL(for: "x-apple-reminder://", with: reminderData) { UIApplication.shared.open(reminderURL) } else { print("Failed to create Reminder URL") } } Also I intend on expanding this function to the notes app. But im taking one step at a time. Any help would be GREATLY appreciated. Thanks!
Replies
0
Boosts
0
Views
1.3k
Activity
Sep ’23
EventKit on Vision Pro
How do I access the user's reminders on Vision Pro? When I use the same code from iOS with EventKit, the reminders and reminder lists are empty. Is the way to access reminders the same on VisionOS as it is on iOS, iPadOS, and macOS? Or is there a new framework? Thanks.
Replies
0
Boosts
0
Views
920
Activity
Sep ’23
Cannot modify title of Event in Calendar
Hi, I'm creating a calendar application. I am using the EKeventEditViewController to add events to my application. The problem is that the title of the sheet cannot be modified. When I change a title, the console shows that the title has changed. However, the simulator still displays the previous title; "New Event". How can I fix it? void (^showEventEditingController)(EKEvent *) = ^(EKEvent * event){ EKEventEditViewController *controller = [[EKEventEditViewController alloc] init]; controller.event = event; controller.eventStore = [self getEventStoreInstance]; controller.editViewDelegate = self; NSLog(@"%@", controller.title); // "New Event" controller.title = @"My Custom title"; NSLog(@"%@", controller.title); // "My Custom title" [self assignNavbarColorsTo:controller.navigationBar]; [self presentViewController:controller]; NSLog(@"%@", controller.title); // "My Custom title" };
Replies
1
Boosts
0
Views
981
Activity
Aug ’23
add EKAttendee on EKEvent, but happen crash issue on iOS16.4
on iOS16.4, if try to add EKAttendee on EKEvent, it will cause app crash; this can not reproduce on iOS14.5/iOS15.7 etc low version. Add Main example Attendee code: Class className = NSClassFromString(@"EKAttendee"); NSMutableArray *attendeessystem = [NSMutableArray new]; for(int i=0; I<1;i++){ id attendee = [className new]; [attendee setValue:@"test" forKey:@"firstName"]; [attendee setValue:@"hihi" forKey:@"lastName"]; [attendee setValue:@"test@outlook.com" forKey:@"emailAddress"]; [attendeessystem addObject:attendee]; } if([attendeessystem count]>0) { [calendarEvent setValue:attendeessystem forKey:@"attendees"]; } crash log: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKeyedSubscript:]: key cannot be nil' *** First throw call stack:
Replies
2
Boosts
0
Views
1.1k
Activity
Aug ’23
Deleting an event deletes the event on the iPhone calendar, but not on the MacBook one.
Hello! I receive events in this way: let store = EKEventStore() let predicate = store.predicateForEvents(withStart: startDate, end: endDate, calendars: nil) let events = store.events(matching: predicate) And remove one of them in this way: try store.remove(event, span: .thisEvent, commit: true) It removes event from iPhone's calendar, but does not from MacBook's. The event came from Google calendar. If I do these things with an event came from iCloud calendar, it works both on iPhone and MacBook. I have tried different ways to solve this problem but without success. I would appreciate any help.
Replies
2
Boosts
0
Views
1.2k
Activity
Jul ’23
iCloud Calender APi integration
Hi there, I am in the process of developing a web app using PHP, and I prefer not to use any packages or libraries. The main functionality of this app will be allowing users to create, edit, and delete calendar events. However, I am currently facing difficulties in determining the best approach to achieve this. I have been unable to find any clear resources or tutorials on how to proceed with implementing the calendar API. My question is, do I need to enroll in the Apple Developer Program to accomplish this? How can i pass authentication and make CRUD operation? I am seeking assistance from someone who can provide detailed guidance on where to start and how to proceed with implementing the calendar functionality. Thank you
Replies
0
Boosts
0
Views
1.2k
Activity
Jul ’23
How to perform an action based on the local time?
Hi! I would like to make text appear based on the local time of the user. The idea is that when it's between 00:00:01 AM and 11:00:00 AM, that the text will say "breakfast" and that when it's between 11:00:00 AM and 03:00:00 PM, the text will say "lunch". Etc. I found this code online but I can't get it working. Can you help me? Possibly with other code? . Contentview: struct Test: View { var now = Date() var breakfastTime = Date.parse("00:00:01") var lunchTime = Date.parse("11:00:00") var dinerTime = Date.parse("16:00:00") func activeDinerCourse() -> String { if now > breakfastTime && now < lunchTime { return "Breakfast" } if now > lunchTime && now < dinerTime { return "Lunch" } if now > dinerTime && now < Date.parse("23:59:59"){ return "Diner" } return "Something went wrong..." } var date = Date.now.formatted(date: .omitted, time: .shortened) var body: some View { VStack { Text("\(date)") Text(activeDinerCourse()) } } } . .Parse extention public extension Date { static func parse(_ string: String, format: String = "HH:mm:ss") -> Date { let dateFormatter = DateFormatter() dateFormatter.timeZone = NSTimeZone.default dateFormatter.dateFormat = format let date = dateFormatter.date(from: string)! return date } func dateString(_ format: String = "HH:mm:ss") -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = format return dateFormatter.string(from: self) } } . Thank you!
Replies
2
Boosts
0
Views
2.0k
Activity
Jun ’23