PMT*_*PMT 7 ios ekevent ekeventkit ekeventstore swift
我想允许我的用户在我的应用中接受/拒绝会议邀请.
我认为我需要的是以某种方式更新EKParticipantStatus,但看起来它无法更新.
Apple Docs:Event Kit无法将参与者添加到活动中,也无法更改参与者信息
在这个stackOverflow问题中有人建议带来本机EventKitUI,我试过这样:
class CalendarViewController: UIViewController, EKEventViewDelegate {
// .....
let eventController = EKEventViewController()
guard let eventWithIdentifier = MeetingsFetcher.eventStoreClass.event(withIdentifier: meeting.UUID) else {
return nil
}
eventController.delegate = self
eventController.event = eventWithIdentifier
eventController.allowsEditing = true
eventController.allowsCalendarPreview = true
let navCon = UINavigationController(rootViewController: eventController)
// customizing the toolbar where the accept/maybe/decline buttons appear
navCon.toolbar.isTranslucent = false
navCon.toolbar.tintColor = .blueGreen
navCon.toolbar.backgroundColor = .coolWhite10
// customizing the nav bar where the OK button appears
navCon.navigationBar.callinAppearence()
present(navCon, animated: true, completion: nil)
// .....
// view gets dismissed, so it does detects the action, but no effect
func eventViewController(_ controller: EKEventViewController, didCompleteWith action: EKEventViewAction) {
controller.dismiss(animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
本机UI显示非常好,但按钮不会在本机日历中产生任何影响.
我错过了什么,或者这是不可能的?如果无法保存任何内容,为什么他们会允许与这些按钮进行交互?
谢谢!
PD:我在info.plist中拥有这些权限:
更新:
请注意,EKEventEditViewController不是我想要的.此屏幕不允许我接受或拒绝该事件,它只允许我编辑细节.
小智 0
要允许用户创建、编辑或删除事件,请使用该EKEventEditViewDelegate
协议。
let eventController = EKEventViewController()
guard let eventWithIdentifier = MeetingsFetcher.eventStoreClass.event(withIdentifier: meeting.UUID) else {
return nil
}
eventController.delegate = self
eventController.event = eventWithIdentifier
eventController.editViewDelegate = self
...
Run Code Online (Sandbox Code Playgroud)
CalendarViewController
类必须符合协议EKEventEditViewDelegate
并且必须实现eventEditViewController
关闭模态视图控制器的方法,如下所示:
func eventEditViewController(_ controller: EKEventEditViewController,
didCompleteWith action: EKEventEditViewAction) {
switch (action) {
case EKEventEditViewActionCanceled:
case EKEventEditViewActionSaved:
...
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
378 次 |
最近记录: |