i got a problem with this code
import UIKit
import EventKit
let eventStore = EKEventStore()
eventStore.requestAccessToEntityType(EKEntityType.Event, completion: { (success, accessError) -> Void in
if accessError != nil {
print("Calendar Access Error: \(accessError)")
return
}
let event = EKEvent(eventStore: eventStore)
event.title = self.detailItem!.title
event.allDay = true
event.startDate = self.detailItem!.date
event.endDate = self.detailItem!.date
event.calendar = eventStore.defaultCalendarForNewEvents
var saveToCalendarError: NSError?
let success: Bool
do {
//Swift2: use of unresolved identifier 'EKSpanThisEvent'
try eventStore.saveEvent(event, span: EKSpanThisEvent)
success = true
} catch var error as NSError {
saveToCalendarError = error
success = false
} catch {
fatalError()
}
the compiler does not compile, and the error is "use of unresolved identifier 'EKSpanThisEvent'"
i hope someone can help!
In Swift 2 / Xcode 7 a lot of enumerations have been changed for consistency
try eventStore.saveEvent(event, span: .ThisEvent)