iOS Setup
The first thing you have to do is to setup the iOS project is to enable the push notification capability to your project. Open the project in Xcode going in ios -> Runner.xcworkspace, then in the Signing & Capabilities tab click on the + Capability button and select "Push Notifications"
Enable push notifications capability
You will have to use a provisoning profile created for this app, you will not be able to test and receive push notification using a wildcard provisioning profile.
Then yu have to modify the AppDelegate class of your application, open AppDelegate.swift file and add this line in the didFinishLaunchingWithOptions function.
1
UNUserNotificationCenter.current().delegate = self
Copied!
The app delegate should look like this.
1
import UIKit
2
import Flutter
3
​
4
@UIApplicationMain
5
@objc class AppDelegate: FlutterAppDelegate {
6
override func application(
7
_ application: UIApplication,
8
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9
) -> Bool {
10
UNUserNotificationCenter.current().delegate = self
11
GeneratedPluginRegistrant.register(with: self)
12
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
13
}
14
}
Copied!
Last modified 11mo ago
Copy link