'application:handleActionWithIdentifier:forRemoteNotification:completionHandler实现中的参数类型冲突

时间:2018-06-26 06:57:06

标签: ios objective-c xcode9.3

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)(void))completionHandler {}

我收到此警告。有人可以告诉我这里出什么问题吗?

  

'application:handleActionWithIdentifier:forRemoteNotification:completionHandler:'的实现中参数类型冲突:'void(^ _Nonnull __strong)()'vs'void(^ __ strong _Nonnull)(void)'

1 个答案:

答案 0 :(得分:3)

一种解决方法是像这样禁用Clang的-Wstrict原型:

- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes" 
completionHandler:(void(^)())completionHandler
#pragma clang diagnostic pop
{}

handleActionWithIdentifier:forLocalNotifications也是如此。 这似乎是一个错误。