albertmontserrat / amgcalendarmanager Goto Github PK
View Code? Open in Web Editor NEWEventKit helper for Swift 3
License: MIT License
EventKit helper for Swift 3
License: MIT License
I'm submitting same event title (Not all the time) but when trying to remove it, it's removing all those titles that are same content.
Is there any option to save a custom Event ID then I can iterate it for removing?
Thanks.
Is there a way to achieve this with this library?
Hi, I love your calendar manager!
I had no issues until I'm trying to introduce events editing in my app.
When I create an event, everything is ok. Then when I change its recurrenceRules, it lands in another store or something, because later manager can't remove all events throwing error:
"NSInvalidArgumentException", "Attempt to remove an object that does not belong to this store."
0 CoreFoundation 0x0000000104af5d4b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010455721e objc_exception_throw + 48 2 EventKit 0x00000001056a0c22 __30-[EKEventStore _deleteObject:]_block_invoke + 0 3 EventKit 0x0000000105656657 -[EKPersistentObject _removeObjectCore:fromValues:relation:] + 544 4 EventKit 0x000000010565693c -[EKPersistentObject primitiveRemoveRelatedObject:forKey:] + 180 5 EventKit 0x0000000105681698 -[EKPersistentCalendarItem removeDetachedItem:] + 265 6 EventKit 0x000000010568178f -[EKPersistentCalendarItem deleteSelfAndDetached] + 224 7 EventKit 0x0000000105668c2f -[EKEvent _deleteWithSpan:error:] + 786 8 EventKit 0x000000010566a3a2 -[EKEvent removeWithSpan:error:] + 509 9 EventKit 0x000000010568f3da -[EKEventStore removeEvent:span:commit:error:] + 299 10 AMGCalendarManager 0x0000000101d3e3e9 _TFC18AMGCalendarManager18AMGCalendarManagerP33_72EF97C106556493E498DAB06AB2172B11deleteEventfT5eventCSo7EKEvent6commitSb_Sb + 153 11 AMGCalendarManager 0x0000000101d3c16f _TFFFC18AMGCalendarManager18AMGCalendarManager15removeAllEventsFT10completionGSqFGSqCSo7NSError_T___T_U_FSbT_U_FTGSqS1__GSqGSaCSo7EKEvent___T_ + 463 12 AMGCalendarManager 0x0000000101d3c2e3 _TTRXFo_oGSqCSo7NSError_oGSqGSaCSo7EKEvent____XFo_iTGSqS__GSqGSaS0_____iT__ + 35 13 AMGCalendarManager 0x0000000101d3f301 _TPA__TTRXFo_oGSqCSo7NSError_oGSqGSaCSo7EKEvent____XFo_iTGSqS__GSqGSaS0_____iT__ + 81 14 AMGCalendarManager 0x0000000101d3c9a3 _TFFC18AMGCalendarManager18AMGCalendarManager12getAllEventsFT10completionGSqFTGSqCSo7NSError_GSqGSaCSo7EKEvent___T___T_U_FSbT_ + 1411 15 AMGCalendarManager 0x0000000101d39ca9 _TFC18AMGCalendarManager18AMGCalendarManager20requestAuthorizationfT10completionFSbT__T_ + 393 16 AMGCalendarManager 0x0000000101d3c3f6 _TFC18AMGCalendarManager18AMGCalendarManager12getAllEventsfT10completionGSqFTGSqCSo7NSError_GSqGSaCSo7EKEvent___T___T_ + 262 17 AMGCalendarManager 0x0000000101d3bf57 _TFFC18AMGCalendarManager18AMGCalendarManager15removeAllEventsFT10completionGSqFGSqCSo7NSError_T___T_U_FSbT_ + 423 18 AMGCalendarManager 0x0000000101d39ca9 _TFC18AMGCalendarManager18AMGCalendarManager20requestAuthorizationfT10completionFSbT__T_ + 393 19 AMGCalendarManager 0x0000000101d3bd66 _TFC18AMGCalendarManager18AMGCalendarManager15removeAllEventsfT10completionGSqFGSqCSo7NSError_T___T_ + 262
This is my code
func changeRepeatEndDate(_ eventId: String, endRepeat: Date, completion: (() -> ())?) {
AMGCalendarManager.shared.getEvent(eventId: eventId) { (error, event) in
if let event = event {
if let recurrenceRules = event.recurrenceRules, recurrenceRules.count > 0 {
for rule in recurrenceRules {
rule.recurrenceEnd = EKRecurrenceEnd(end: endRepeat)
}
self.calendarManager.saveEvent(event: event, completion: { (error) in
if let error = error {
fatalError("Error during saving an Event with ID \(eventId) - \(error.localizedDescription)")
} else {
completion?()
}
})
}
} else {
if let error = error {
fatalError("Error during getting an Event with ID \(eventId) - \(error.localizedDescription)")
} else {
fatalError("No event in the store")
}
}
}
}
AMGCalendarManager.shared.removeAllEvents()
HI. I have a problem。when I used the manager add Recurrence rule to Event. I get a issues. that can't
add event to the calendar.
let rule = EKRecurrenceRule.init(recurrenceWith: .daily, interval: 1, end: nil) event.addRecurrenceRule(rule)
that is debug info: Error Domain=CalendarError Code=999 "Unknown Error" UserInfo={NSLocalizedDescription=Unknown Error, NSLocalizedFailureReason=An unknown error ocurred while trying to sync your calendar. Syncing will be turned off.}
is everyone has this issues?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.