Use AppDelegate in Today's Extension

I am trying to create today's extension for my application.

I use CoreData

and NSFetchedResultsController

and get the following error:

Using the undeclared type "AppDelegate"

In this line of code:

var appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate. 

      

Does anyone know how to solve this error / use AppDelegate in today's extension and would like to help me?

+3


source to share


1 answer


A Today Extension is not an application, so UIApplication and AppDelegate are not available. I'm not sure what you are trying to do with the AppDelegate, but the extensions have an NSExtensionContext by calling:



 self.extensionContext

      

+2


source







All Articles