ios – ‘userNotificationCenter:didReceiveNotificationResponse’实现中的冲突参数类型

前端之家收集整理的这篇文章主要介绍了ios – ‘userNotificationCenter:didReceiveNotificationResponse’实现中的冲突参数类型前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
错误刚刚开始弹出.是bug还是更新?

Conflicting parameter types in implementation of 'userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:': 'void (^ _Nonnull __strong)(void)' vs 'void (^__strong _Nonnull)()'

我的守则

// Handle notification messages after display notification is tapped by the user.
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {

先前的定义(他们的代码)

// The method will be called on the delegate when the user responded to the notification by opening the application,dismissing the notification or choosing a UNNotificationAction. The delegate must be set before the application returns from application:didFinishLaunchingWithOptions:.
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler __IOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) __TVOS_PROHIBITED;

解决方法

我有同样的问题.我改成了:

- (void)userNotificationCenter:(UNUserNotificationCenter *)center 
didReceiveNotificationResponse:(UNNotificationResponse *)response 
         withCompletionHandler:(void (^)(void))completionHandler;

现在警告消失了.

猜你在找的Xcode相关文章