From 8da7d03ecc3570b4597acc223cb3c136627de0d6 Mon Sep 17 00:00:00 2001 From: som-R91 <30408993+som-R91@users.noreply.github.com> Date: Sat, 5 Nov 2022 05:50:00 +0530 Subject: [PATCH] Updates readme for iOS Setup Adds the import statement required for AppDelegate.swift and AppDelegate.m to use FlutterLocalNotificationsPlugin's setPluginRegistrantCallback function. --- flutter_local_notifications/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flutter_local_notifications/README.md b/flutter_local_notifications/README.md index e6347fd43..dcb2c33be 100644 --- a/flutter_local_notifications/README.md +++ b/flutter_local_notifications/README.md @@ -360,6 +360,10 @@ Adjust `AppDelegate.m` and set the plugin registrant callback: If you're using Objective-C, add this function anywhere in AppDelegate.m: ``` objc +// This is required for calling FlutterLocalNotificationsPlugin.setPluginRegistrantCallback method. +#import +... +... void registerPlugins(NSObject* registry) { [GeneratedPluginRegistrant registerWithRegistry:registry]; } @@ -380,6 +384,12 @@ For Swift, open the `AppDelegate.swift` and update the `didFinishLaunchingWithOp where the commented code indicates the code to add in and why ```swift +import UIKit +import Flutter +// This is required for calling FlutterLocalNotificationsPlugin.setPluginRegistrantCallback method. +import flutter_local_notifications + +@UIApplicationMain override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?