- Apple Push Notification 등록
- Firebase 연동
- Info.plist 파일에 추가
<key>FirebaseAppDelegateProxyEnabled</key>
<string>0</string>
<key>FirebaseScreenReportingEnabled</key>
<true/>
- AppDelegate.swift에 추가
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
}
- Firebase Messaging listener 부여할 때 권한주기
void _requestIOSPermission() {
_firebaseMessaging.requestNotificationPermissions(
IosNotificationSettings(sound: true, badge: true, alert: true)
);
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings)
{
print("Settings registered: $settings");
});
}
- Xcode > Runner > TARGETS > Signin & Capabilities > + Capability에서 기능 추가하기
- Background Modes > Remote notifications
- Push Notifications