Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
2024b4b983
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  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
     }