快速读取已订阅日历的服务器地址?

时间:2019-02-28 14:18:12

标签: swift server ekeventstore webcal ekcalendar

是否有可能迅速读取已订阅日历的服务器地址?

我的意思是这个领域: Server Field in Settings

我尝试过:

let eventStore = EKEventStore()
let url = URL(string: in_)
eventStore.requestAccess(to: .event, completion: {(granted, error) -> Void in


    let allCalendars = eventStore.calendars(for: .event)
    for currentCal : EKCalendar in allCalendars {

            print(currentCal.title)
            print(currentCal.type)
            print(currentCal.source)
            print(currentCal.calendarIdentifier)

            if (currentCal.type == EKCalendarType.subscription && currentCal.title == url!.absoluteString) {
                print("Already Subscribed")
                alreadySubscribed = true
                break
            }
        }
        if (!alreadySubscribed) {
            DispatchQueue.main.async(execute: {
                if UIApplication.shared.canOpenURL(url!) {
                    UIApplication.shared.open(url!, options: [:], completionHandler: { (success) in
                        print("Open url : \(success)")
                    })
                }
            })


        }
    })

感谢您的帮助!

0 个答案:

没有答案