Eventstore permission error on iOS 17

 Problem:

Event store permissions are to be like that below in previous versions of iOS but in iOS 17 it shows an exception.


                    eventDB.requestFullAccessToEvents(completion: {(granted, error) in

                        if granted {


}
})

Solution:


        let eventDB = appdel.eventStoreNew!//EKEventStore.init()

        if #available(iOS 17.0, *) {

            eventDB.requestFullAccessToEvents(completion: {(grantedEvent, error) in

                print(grantedEvent)

            })

            eventDB.requestFullAccessToReminders(completion: { (grantedEvent, error) in

                if grantedEvent {


}
})

else {

            // Fallback on earlier versions

            

            eventDB.requestAccess(to: .eventcompletion: { (granted, error) in

                if granted {

                }})

            eventDB.requestAccess(to: .remindercompletion: { (grantedEvent, error) in

                if grantedEvent {

}
})


}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift