在 -Swift.h 文件中找不到“UNUserNotificationCenterDelegate”的协议声明

阿宾乔治

我试图将我的目标 C AppDelegate 转换为 Swift AppDelegate。所以我删除了 main.m 文件并将所有 AppDelegate 代码转换为 swift。我试图运行该项目,然后发生此错误。

找不到“UNUserNotificationCenterDelegate”的协议声明

在他们生成的 -Swift.h 文件中,这是他们展示的委托

- (void)userNotificationCenter:(UNUserNotificationCenter * _Nonnull)center willPresentNotification:(UNNotification * _Nonnull)notification withCompletionHandler:(void (^ _Nonnull)(UNNotificationPresentationOptions))completionHandler SWIFT_AVAILABILITY(ios,introduced=10.0);

我是这样写的

@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    handleNotification(notification.request.content.userInfo)
}

请帮助我了解我面临的问题。

我尝试过,清理,重新启动 Xcode 并重新启动我的 Mac。我正在使用 Swift 3.2。

这是我的 -Swift.h 文件错误 在此处输入图片说明

如果我评论代表,没有错误。

阿宾乔治

奇怪的修复,但通过在我的桥接头中导入 #import 问题得到解决。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章