0

I have application that uses Calendar.

The project worked fine until today. I tried to run app on the same device and got an error:

Predicate call to calendar daemon failed: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)"

Here is relevant code:

_estore = EKEventStore()

//_estore.reset() // tried - doesn't help

var predicate:NSPredicate! = _eventStore.predicateForEventsWithStartDate(yearsAgo, endDate:toAgo, calendars:allCals)

 _eventStore.enumerateEventsMatchingPredicate(predicate, usingBlock:{
            (event:EKEvent!, stop:UnsafeMutablePointer<ObjCBool>) in 

    ...

}) // block

I tried without block implementation:

var allEvents:Array<EKEvent> = _eventStore.eventsMatchingPredicate(predicate) as [AnyObject]! as Array<EKEvent>

I checked Device->Settings -> Privacy -> Reminder - is empty

BTW I don't see any permissions into Settings-> Privacy -> Calendar

Sounds like the device doesn't detect that my app uses Calendar.

BTW, I succeeded to fetch contacts

Other info

  • iOS ver. 7.1.2
  • I have two accounts on device
  • reinstall app doesn't help
  • code didn't change from yesterday
  • Device restart doesn't help

Any suggestions?

[EDIT]

var calendars = _estore.calendarsForEntityType(EKEntityTypeEvent)

returns nothing (a.e. empty list)

Thanks,

snaggs
  • 5,543
  • 17
  • 64
  • 127
  • Possible duplicate of [defaultCalendarForNewEvents failed](http://stackoverflow.com/questions/12454324/defaultcalendarfornewevents-failed) – jrc Oct 02 '15 at 15:37

1 Answers1

2

I forced "Allow popup:"

_estore.requestAccessToEntityType(EKEntityTypeEvent, completion: {(res:Bool!, error:NSError!) in
            if  res == true {
               // println("allowed")
            } else {
                //println("not allowed")
            }

        })

That did the job.

Thank you anyways,

snaggs
  • 5,543
  • 17
  • 64
  • 127