ソースを参照

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 年 前
コミット
2024b4b983
1 ファイル変更5 行追加0 行削除
  1. 5 0
      LoopFollow/AppDelegate.swift

+ 5 - 0
LoopFollow/AppDelegate.swift

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