Flutter iOS FCM 연동

다은·2021년 8월 27일
0

🎯 Flutter

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

0개의 댓글