Mike Flynn
Mike Flynn

Reputation: 24325

Conflicting parameter types in implementation of 'userNotificationCenter:didReceiveNotificationResponse

This error just started to popup. Is it a bug or an update?

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

My Code

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

Previous Definition (Their Code)

// 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;

Upvotes: 4

Views: 2646

Answers (2)

firebear
firebear

Reputation: 774

For you information, from https://forums.developer.apple.com/thread/78855:

same. But following the spec at this link, I added "void" in the empty parentheses and it was happy https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/SchedulingandHandlingLocalNotifications.html

(void (^)(void))completionHandler...

Upvotes: 1

Student
Student

Reputation: 408

I had the same problem. I changed it to:

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

and now the warning is gone.

Upvotes: 3

Related Questions