ios - EKEventEditViewController freezes app and loads after long time -
i have following code in swift:
var eventcontroller = ekeventeditviewcontroller() eventcontroller.editviewdelegate = self var store = ekeventstore() eventcontroller.eventstore = store var event = ekevent(eventstore: store) event.title = viewmodel.rolename event.location = viewmodel.location event.startdate = viewmodel.startdate event.enddate = viewmodel.enddate eventcontroller.event = event var status = ekeventstore.authorizationstatusforentitytype(ekentitytypeevent) switch status { case .authorized: self.setnavbarappearancestandard() dispatch_async(dispatch_get_main_queue(), { () -> void in self.presentviewcontroller(eventcontroller, animated: true, completion: nil) }) case .notdetermined: store.requestaccesstoentitytype(ekentitytypeevent, completion: { (granted, error) -> void in if granted == true { self.setnavbarappearancestandard() dispatch_async(dispatch_get_main_queue(), { () -> void in self.presentviewcontroller(eventcontroller, animated: true, completion: nil) }) } }) case .denied, .restricted: uialertview(title: "access denied", message: "permission needed access calendar. go settings > privacy > calendars allow access collective app.", delegate: nil, cancelbuttontitle: "ok").show() return }
it's pretty straight forward. works on simulator. when try run code on device, whole ui freezes , after 1 minute edit event view controller comes up, , not @ all.
please help.
after bit of digging i've manager figure out eventstore (ekeventstore) variable must instance variable or global var in singleton class. if local var take forever present view controller. optimisation issues on sdk.
Comments
Post a Comment