diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 28a4a153e2cc10341db407be9cd8eefcb261c3e4..998211ed779a0bb0b313b7e72044bee4a5a51119 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -83,11 +83,14 @@ static NSString* kBackgroundFetchCapatibility = @"fetch"; - (void)userNotificationCenter:(UNUserNotificationCenter*)center willPresentNotification:(UNNotification*)notification withCompletionHandler: - (void (^)(UNNotificationPresentationOptions options))completionHandler { - if ([_lifeCycleDelegate respondsToSelector:_cmd]) { - [_lifeCycleDelegate userNotificationCenter:center - willPresentNotification:notification - withCompletionHandler:completionHandler]; + (void (^)(UNNotificationPresentationOptions options))completionHandler + NS_AVAILABLE_IOS(10_0) { + if (@available(iOS 10.0, *)) { + if ([_lifeCycleDelegate respondsToSelector:_cmd]) { + [_lifeCycleDelegate userNotificationCenter:center + willPresentNotification:notification + withCompletionHandler:completionHandler]; + } } } @@ -96,11 +99,13 @@ static NSString* kBackgroundFetchCapatibility = @"fetch"; */ - (void)userNotificationCenter:(UNUserNotificationCenter*)center didReceiveNotificationResponse:(UNNotificationResponse*)response - withCompletionHandler:(void (^)(void))completionHandler { - if ([_lifeCycleDelegate respondsToSelector:_cmd]) { - [_lifeCycleDelegate userNotificationCenter:center - didReceiveNotificationResponse:response - withCompletionHandler:completionHandler]; + withCompletionHandler:(void (^)(void))completionHandler NS_AVAILABLE_IOS(10_0) { + if (@available(iOS 10.0, *)) { + if ([_lifeCycleDelegate respondsToSelector:_cmd]) { + [_lifeCycleDelegate userNotificationCenter:center + didReceiveNotificationResponse:response + withCompletionHandler:completionHandler]; + } } } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm index 677dac7bfc01246aed37e17e1bcb863d2669c9ab..8c7877b44d50baaf892762b0fb8e02f2263ce515 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPluginAppLifeCycleDelegate.mm @@ -275,24 +275,29 @@ static BOOL isPowerOfTwo(NSUInteger x) { - (void)userNotificationCenter:(UNUserNotificationCenter*)center willPresentNotification:(UNNotification*)notification withCompletionHandler: - (void (^)(UNNotificationPresentationOptions options))completionHandler { - for (NSObject* delegate in _delegates) { - if ([delegate respondsToSelector:_cmd]) { - [delegate userNotificationCenter:center - willPresentNotification:notification - withCompletionHandler:completionHandler]; + (void (^)(UNNotificationPresentationOptions options))completionHandler + NS_AVAILABLE_IOS(10_0) { + if (@available(iOS 10.0, *)) { + for (NSObject* delegate in _delegates) { + if ([delegate respondsToSelector:_cmd]) { + [delegate userNotificationCenter:center + willPresentNotification:notification + withCompletionHandler:completionHandler]; + } } } } - (void)userNotificationCenter:(UNUserNotificationCenter*)center didReceiveNotificationResponse:(UNNotificationResponse*)response - withCompletionHandler:(void (^)(void))completionHandler { - for (id delegate in _delegates) { - if ([delegate respondsToSelector:_cmd]) { - [delegate userNotificationCenter:center - didReceiveNotificationResponse:response - withCompletionHandler:completionHandler]; + withCompletionHandler:(void (^)(void))completionHandler NS_AVAILABLE_IOS(10_0) { + if (@available(iOS 10.0, *)) { + for (id delegate in _delegates) { + if ([delegate respondsToSelector:_cmd]) { + [delegate userNotificationCenter:center + didReceiveNotificationResponse:response + withCompletionHandler:completionHandler]; + } } } }