Swift 4.0 EventKit:问题本机界面将事件添加到日历

时间:2018-11-13 10:12:37

标签: ios iphone swift eventkit

我想使用Swift 4和XCode 10.1将事件添加到本机日历中。 我在显示本机界面时遇到问题,该界面的单元格显示错误 谢谢您的回答

let eventStore = EKEventStore()
    eventStore.requestAccess( to: EKEntityType.event, completion:{(granted, error) in
        DispatchQueue.main.async {
            if (granted) && (error == nil) {
                let event = EKEvent(eventStore: eventStore)
                event.title = "test"
                event.location = "test"
                event.startDate = Date()
                event.endDate = Date()
                event.notes = "test Data"
                let eventController = EKEventEditViewController()
                eventController.event = event
                eventController.eventStore = eventStore
                eventController.editViewDelegate = self
                self.present(eventController, animated: true, completion: nil)
            }
        }
    })

结果:

https://i.stack.imgur.com/sVqIo.png

0 个答案:

没有答案