iOS EventKit - Event is not being deleted from cal

2019-02-19 06:59发布

I'm deleting event using the following code

[store requestAccessToEntityType:EKEntityTypeEvent completion: ^(BOOL granted, NSError *error) {
    if (granted) {
        EKEvent *event = [store eventWithIdentifier:eventIdentifier];
        NSError *eventDeleteError = nil;
        if (event) {
            [store removeEvent:event span:EKSpanThisEvent error:&eventDeleteError];
        }

        if (eventDeleteError) {
            NSLog(@"Event Deletion Error: %@", eventDeleteError);
        }

}];

I got no error in eventDeleteError but following message appear in the console log

CADObjectGetInlineStringProperty failed fetching UUID for EKPersistentAttendee with error Error Domain=EKCADErrorDomain Code=1010 "The operation couldn’t be completed. (EKCADErrorDomain error 1010.)"

2条回答
甜甜的少女心
2楼-- · 2019-02-19 07:33

I was getting similar error on removing a calendar:

CADObjectGetIntProperty failed with error Error Domain=EKCADErrorDomain Code=1010 "The operation couldn’t be completed. (EKCADErrorDomain error 1010.)" CADObjectGetRelation failed with error Error Domain=EKCADErrorDomain Code=1010 "The operation couldn’t be completed. (EKCADErrorDomain error 1010.)"

As it is not exactly the same message I will just explain what helped me. The issue came from making "remove" operation on a new EventStore object. Try to make sure you hold a reference to EventStore and both adding and removing operations are called on the same object.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-02-19 07:43

I've gotten this error several times and it's always because my eventIdentifier is bad and there is no matching record for my eventIdentifier. Always my code has been at fault.

查看更多
登录 后发表回答