我正在尝试为我的应用构建今天的扩展。
我正在使用 CoreData
和 NSFetchedResultsController
并收到以下错误:
Use of undeclared type 'AppDelegate'
在这行代码中:
var appDel: AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate.
有人知道如何解决这个错误/在今天的扩展中使用 AppDelegate 并愿意帮助我吗?
最佳答案
Today Extension 不是应用程序,因此 UIApplication 和 AppDelegate 不可用。我不确定你想用 AppDelegate 做什么,但扩展确实有一个 NSExtensionContext可调用:
self.extensionContext
关于ios - 在今天的扩展中使用 AppDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29720440/