Просмотр исходного кода

Added missing calendar access request on app launch.
Previously it would take 1 attempted write to the calendar before you could select the calendar to write to.

Jon Fawcett 6 лет назад
Родитель
Сommit
2024b4b983
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      LoopFollow/AppDelegate.swift

+ 5 - 0
LoopFollow/AppDelegate.swift

@@ -9,6 +9,7 @@
 import UIKit
 import CoreData
 import UserNotifications
+import EventKit
 
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -27,6 +28,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
                 print("User has declined notifications")
             }
         }
+        let store = EKEventStore()
+        store.requestAccess(to: .event) {(granted, error) in
+        if !granted { return }
+            }
          
         return true
     }